diff --git a/api/operator/v1/cluster_types_test.go b/api/operator/v1/cluster_types_test.go
index 9bca6afe18..70d35511ca 100644
--- a/api/operator/v1/cluster_types_test.go
+++ b/api/operator/v1/cluster_types_test.go
@@ -19,8 +19,10 @@ func TestVTCluster_AvailableStorageNodeIDs(t *testing.T) {
cr := &VTCluster{
Spec: VTClusterSpec{
Storage: &VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(5)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(5)),
+ },
},
MaintenanceSelectNodeIDs: []int32{1, 3},
MaintenanceInsertNodeIDs: []int32{0, 4},
@@ -38,7 +40,9 @@ func TestVTCluster_AvailableStorageNodeIDs(t *testing.T) {
f(&VTCluster{
Spec: VTClusterSpec{
Storage: &VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(3))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(3))},
+ },
},
},
}, vmv1beta1.ClusterComponentSelect, []int32{0, 1, 2})
@@ -54,8 +58,10 @@ func TestVLCluster_AvailableStorageNodeIDs(t *testing.T) {
cr := &VLCluster{
Spec: VLClusterSpec{
VLStorage: &VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(5)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(5)),
+ },
},
MaintenanceSelectNodeIDs: []int32{1, 3},
MaintenanceInsertNodeIDs: []int32{0, 4},
@@ -73,7 +79,9 @@ func TestVLCluster_AvailableStorageNodeIDs(t *testing.T) {
f(&VLCluster{
Spec: VLClusterSpec{
VLStorage: &VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(3))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(3))},
+ },
},
},
}, vmv1beta1.ClusterComponentSelect, []int32{0, 1, 2})
diff --git a/api/operator/v1/common.go b/api/operator/v1/common.go
index 5abd8f6a0a..53784e2cbd 100644
--- a/api/operator/v1/common.go
+++ b/api/operator/v1/common.go
@@ -7,11 +7,15 @@ import (
"strconv"
corev1 "k8s.io/api/core/v1"
+
+ vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
)
const (
healthPath = "/health"
metricsPath = "/metrics"
+ // OTLPGRPCPortName is the Service/container port name generated for the OTLP gRPC listener.
+ OTLPGRPCPortName = "otlp-grpc"
)
// TLSServerConfig defines VictoriaMetrics TLS configuration for the application's server
@@ -51,18 +55,40 @@ type OTLPGRPCSpec struct {
TLSConfig *TLSServerConfig `json:"tlsConfig,omitempty"`
}
-// Validate checks that ListenPort doesn't collide with httpPort, the port already used for
-// the component's main HTTP listener.
-func (g *OTLPGRPCSpec) Validate(httpPort string) error {
+// Validate checks that ListenPort doesn't collide with httpPort or any configured HTTPListener,
+// and that no HTTPListener is named OTLPGRPCPortName.
+func (g *OTLPGRPCSpec) Validate(httpPort string, listeners []vmv1beta1.HTTPListener) error {
if g == nil {
return nil
}
- if strconv.Itoa(int(g.ListenPort)) == httpPort {
- return fmt.Errorf("spec.grpcSpec.listenPort=%d must not be equal to the HTTP listen port=%s", g.ListenPort, httpPort)
+ if len(listeners) == 0 {
+ if portsEqual(strconv.Itoa(int(g.ListenPort)), httpPort) {
+ return fmt.Errorf("spec.grpcSpec.listenPort=%d must not be equal to the HTTP listen port=%s", g.ListenPort, httpPort)
+ }
+ return nil
+ }
+ for i := range listeners {
+ if listeners[i].Name == OTLPGRPCPortName {
+ return fmt.Errorf("httpListeners[%d].name cannot be %q while spec.grpcSpec is enabled, since it collides with the generated OTLP gRPC port name", i, OTLPGRPCPortName)
+ }
+ if port := listeners[i].AddrPort(); portsEqual(strconv.Itoa(int(g.ListenPort)), port) {
+ return fmt.Errorf("spec.grpcSpec.listenPort=%d must not be equal to httpListeners[%d].addr port=%s", g.ListenPort, i, port)
+ }
}
return nil
}
+// portsEqual compares two port strings numerically when both parse as integers,
+// falling back to a plain string comparison otherwise.
+func portsEqual(a, b string) bool {
+ ai, aerr := strconv.Atoi(a)
+ bi, berr := strconv.Atoi(b)
+ if aerr != nil || berr != nil {
+ return a == b
+ }
+ return ai == bi
+}
+
// OAuth2 defines OAuth2 configuration parameters
// with optional references to secrets with corresponding sensitive values
type OAuth2 struct {
diff --git a/api/operator/v1/common_test.go b/api/operator/v1/common_test.go
index a1fa35ffd8..de6fd50c60 100644
--- a/api/operator/v1/common_test.go
+++ b/api/operator/v1/common_test.go
@@ -1,11 +1,15 @@
package v1
-import "testing"
+import (
+ "testing"
+
+ vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
+)
func TestOTLPGRPCSpec_Validate(t *testing.T) {
- f := func(g *OTLPGRPCSpec, httpPort string, wantErr bool) {
+ f := func(g *OTLPGRPCSpec, httpPort string, listeners []vmv1beta1.HTTPListener, wantErr bool) {
t.Helper()
- err := g.Validate(httpPort)
+ err := g.Validate(httpPort, listeners)
if wantErr && err == nil {
t.Fatalf("expected error, got nil")
}
@@ -15,11 +19,31 @@ func TestOTLPGRPCSpec_Validate(t *testing.T) {
}
// nil spec is always valid
- f(nil, "10429", false)
+ f(nil, "10429", nil, false)
// distinct ports
- f(&OTLPGRPCSpec{ListenPort: 4317}, "10429", false)
+ f(&OTLPGRPCSpec{ListenPort: 4317}, "10429", nil, false)
// colliding with the HTTP port
- f(&OTLPGRPCSpec{ListenPort: 10429}, "10429", true)
+ f(&OTLPGRPCSpec{ListenPort: 10429}, "10429", nil, true)
+
+ // a listener named like the generated OTLP gRPC port collides
+ f(&OTLPGRPCSpec{ListenPort: 4317}, "10429", []vmv1beta1.HTTPListener{
+ {Name: "otlp-grpc", Addr: ":10429"},
+ }, true)
+
+ // a listener with a different name is fine
+ f(&OTLPGRPCSpec{ListenPort: 4317}, "10429", []vmv1beta1.HTTPListener{
+ {Name: "http", Addr: ":10429"},
+ }, false)
+
+ // a listener's own port colliding with the gRPC port is invalid, even with a different name
+ f(&OTLPGRPCSpec{ListenPort: 4317}, "10429", []vmv1beta1.HTTPListener{
+ {Name: "http", Addr: ":4317"},
+ }, true)
+
+ // nil grpcSpec is always valid, regardless of listener names
+ f(nil, "10429", []vmv1beta1.HTTPListener{
+ {Name: "otlp-grpc", Addr: ":4317"},
+ }, false)
}
diff --git a/api/operator/v1/vlagent_types.go b/api/operator/v1/vlagent_types.go
index 27e83fd6f3..9277b09d5e 100644
--- a/api/operator/v1/vlagent_types.go
+++ b/api/operator/v1/vlagent_types.go
@@ -3,7 +3,6 @@ package v1
import (
"encoding/json"
"fmt"
- "strings"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
@@ -107,8 +106,8 @@ type VLAgentSpec struct {
UseLegacyNaming bool `json:"useLegacyNaming,omitempty"`
// Configures vertical pod autoscaling.
// +optional
- VPA *vmv1beta1.EmbeddedVPA `json:"vpa,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline,omitempty"`
+ VPA *vmv1beta1.EmbeddedVPA `json:"vpa,omitempty"`
+ vmv1beta1.StandardAppsParams `json:",inline,omitempty"`
}
type VLAgentK8sCollector struct {
@@ -171,6 +170,9 @@ func (cr *VLAgent) Validate() error {
if cr.Spec.ServiceSpec != nil && cr.Spec.ServiceSpec.Name == cr.PrefixedName() {
return fmt.Errorf("spec.serviceSpec.Name cannot be equal to prefixed name=%q", cr.PrefixedName())
}
+ if err := cr.Spec.SyslogSpec.ValidateNoListenerNameCollision(cr.Spec.HTTPListeners); err != nil {
+ return err
+ }
if len(cr.Spec.RemoteWrite) == 0 {
return fmt.Errorf("spec.remoteWrite cannot be empty array, provide at least one remoteWrite")
}
@@ -209,7 +211,7 @@ func (cr *VLAgent) Validate() error {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VLAgent) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.Spec.ExtraArgs)
+ return cr.Spec.UseProxyProtocol()
}
// VLAgentRemoteWriteSettings - defines global settings for all remoteWrite urls.
@@ -460,7 +462,12 @@ func (cr *VLAgent) GetMetricsPath() string {
// UseTLS returns true if TLS is enabled
func (cr *VLAgent) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.Spec.ExtraArgs)
+ return cr.Spec.UseTLS()
+}
+
+// PrimaryPortName returns the Service port name generated for the primary listener.
+func (cr *VLAgent) PrimaryPortName() string {
+ return cr.Spec.PrimaryPortName()
}
// ExtraArgs returns additionally configured command-line arguments
@@ -486,14 +493,17 @@ func (cr *VLAgent) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
+// Params implements build.scrapeBuilder and urlBuilder interfaces
+func (cr *VLAgent) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &cr.Spec.StandardAppsParams
+}
+
// AsURL - returns url for http access
-func (cr *VLAgent) AsURL(isExtra bool) string {
- specPort := cr.Spec.Port
- if specPort == "" {
- specPort = "9429"
+func (cr *VLAgent) AsURL(nsn vmv1beta1.NamespacedName) (string, error) {
+ if nsn.ListenerName != "" && cr.Spec.ByName(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VLAgent=%q httpListeners", nsn.ListenerName, cr.Name)
}
- svcName, port := vmv1beta1.ResolveServiceURL(cr.PrefixedName(), specPort, "http", cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs), svcName, cr.Namespace, port)
+ return vmv1beta1.BuildServiceURL(cr, nsn)
}
// ProbePath implements build.probeCRD interface
@@ -501,16 +511,6 @@ func (cr *VLAgent) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VLAgent) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VLAgent) ProbePort() string {
- return cr.Spec.Port
-}
-
func (cr *VLAgent) GetRBACName() string {
return fmt.Sprintf("monitoring:%s:vlagent-%s", cr.Namespace, cr.Name)
}
diff --git a/api/operator/v1/vlcluster_types.go b/api/operator/v1/vlcluster_types.go
index c6d3ea4699..30589a3cf5 100644
--- a/api/operator/v1/vlcluster_types.go
+++ b/api/operator/v1/vlcluster_types.go
@@ -271,7 +271,12 @@ type VLInsert struct {
// +optional
RollingUpdate *appsv1.RollingUpdateDeployment `json:"rollingUpdate,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline"`
+ vmv1beta1.StandardAppsParams `json:",inline"`
+}
+
+// Params implements build.scrapeBuilder interface
+func (p *VLInsert) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &p.StandardAppsParams
}
// ProbePath implements build.probeCRD interface
@@ -281,17 +286,7 @@ func (cr *VLInsert) ProbePath() string {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VLInsert) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
-}
-
-// ProbeScheme implements build.probeCRD interface
-func (cr *VLInsert) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VLInsert) ProbePort() string {
- return cr.Port
+ return cr.StandardAppsParams.UseProxyProtocol()
}
// ProbeNeedLiveness implements build.probeCRD interface
@@ -312,11 +307,6 @@ func (cr *VLInsert) GetExtraArgs() map[string]string {
return cr.ExtraArgs
}
-// UseTLS returns true if TLS is enabled
-func (cr *VLInsert) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.ExtraArgs)
-}
-
// ServiceScrape returns overrides for serviceScrape builder
func (cr *VLInsert) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
@@ -386,6 +376,27 @@ type SyslogUDPListener struct {
CompressMethod string `json:"compressMethod,omitempty"`
}
+// ValidateNoListenerNameCollision rejects HTTPListener names that collide with the
+// container port names generated for this SyslogServerSpec's configured listeners.
+func (s *SyslogServerSpec) ValidateNoListenerNameCollision(listeners []vmv1beta1.HTTPListener) error {
+ if s == nil {
+ return nil
+ }
+ reserved := make(map[string]struct{}, len(s.TCPListeners)+len(s.UDPListeners))
+ for idx := range s.TCPListeners {
+ reserved[fmt.Sprintf("syslog-tcp-%d", idx)] = struct{}{}
+ }
+ for idx := range s.UDPListeners {
+ reserved[fmt.Sprintf("syslog-udp-%d", idx)] = struct{}{}
+ }
+ for i := range listeners {
+ if _, ok := reserved[listeners[i].Name]; ok {
+ return fmt.Errorf("httpListeners[%d].name=%q collides with a name generated for spec.syslogSpec", i, listeners[i].Name)
+ }
+ }
+ return nil
+}
+
// FieldsListString represents list of json encoded strings
// ["field"] or ["field1","field2"]
type FieldsListString string
@@ -464,7 +475,12 @@ type VLSelect struct {
// ExtraStorageNodes - defines additional storage nodes to VLSelect
ExtraStorageNodes []VLStorageNode `json:"extraStorageNodes,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline"`
+ vmv1beta1.StandardAppsParams `json:",inline"`
+}
+
+// Params implements build.scrapeBuilder interface
+func (p *VLSelect) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &p.StandardAppsParams
}
// GetMetricsPath returns prefixed path for metric requests
@@ -477,7 +493,7 @@ func (cr *VLSelect) GetMetricsPath() string {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VLSelect) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
+ return cr.StandardAppsParams.UseProxyProtocol()
}
// ExtraArgs returns additionally configured command-line arguments
@@ -485,11 +501,6 @@ func (cr *VLSelect) GetExtraArgs() map[string]string {
return cr.ExtraArgs
}
-// UseTLS returns true if TLS is enabled
-func (cr *VLSelect) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.ExtraArgs)
-}
-
// ServiceScrape returns overrides for serviceScrape builder
func (cr *VLSelect) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
@@ -500,16 +511,6 @@ func (cr *VLSelect) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VLSelect) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VLSelect) ProbePort() string {
- return cr.Port
-}
-
// ProbeNeedLiveness implements build.probeCRD interface
func (*VLSelect) ProbeNeedLiveness() bool {
return true
@@ -605,7 +606,7 @@ type VLStorage struct {
// +optional
MaintenanceSelectNodeIDs []int32 `json:"maintenanceSelectNodeIDs,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline"`
+ vmv1beta1.StandardAppsParams `json:",inline"`
// RollingUpdateStrategyBehavior defines customized behavior for rolling updates.
// It applies if the RollingUpdateStrategy is set to OnDelete, which is the default.
@@ -623,7 +624,12 @@ func (cr *VLStorage) GetStorageVolumeName() string {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VLStorage) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
+ return cr.StandardAppsParams.UseProxyProtocol()
+}
+
+// Params implements build.scrapeBuilder interface
+func (cr *VLStorage) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &cr.StandardAppsParams
}
// GetMetricsPath returns prefixed path for metric requests
@@ -639,11 +645,6 @@ func (cr *VLStorage) GetExtraArgs() map[string]string {
return cr.ExtraArgs
}
-// UseTLS returns true if TLS is enabled
-func (cr *VLStorage) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.ExtraArgs)
-}
-
// ServiceScrape returns overrides for serviceScrape builder
func (cr *VLStorage) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
@@ -654,16 +655,6 @@ func (cr *VLStorage) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VLStorage) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VLStorage) ProbePort() string {
- return cr.Port
-}
-
// ProbeNeedLiveness implements build.probeCRD interface
func (*VLStorage) ProbeNeedLiveness() bool {
return false
@@ -748,6 +739,11 @@ func (cr *VLCluster) Validate() error {
return err
}
}
+ if !cr.Spec.RequestsLoadBalancer.Enabled {
+ if err := vli.SyslogSpec.ValidateNoListenerNameCollision(vli.HTTPListeners); err != nil {
+ return fmt.Errorf("vlinsert: %w", err)
+ }
+ }
if err := vli.Validate(); err != nil {
return fmt.Errorf("vlinsert: %w", err)
}
@@ -762,6 +758,9 @@ func (cr *VLCluster) Validate() error {
if vls.HPA != nil && vls.HPA.Behaviour != nil && vls.HPA.Behaviour.ScaleDown != nil {
return fmt.Errorf("vlstorage scaledown HPA behavior is not supported")
}
+ if vls.UseTLS() {
+ return fmt.Errorf("vlstorage: primary httpListener cannot enable tls, since vlinsert and vlselect connect to it as plain HTTP for cluster-internal storageNode communication")
+ }
if vls.VPA != nil {
if err := vls.VPA.Validate(); err != nil {
return err
@@ -821,32 +820,11 @@ func (cr *VLCluster) Validate() error {
// AvailableStorageNodeIDs returns ids of the storage nodes for the provided component
func (cr *VLCluster) AvailableStorageNodeIDs(kind vmv1beta1.ClusterComponent) []int32 {
- var result []int32
- if cr.Spec.VLStorage == nil || (cr.Spec.VLStorage.ReplicaCount == nil && cr.Spec.VLStorage.HPA == nil) {
- return result
- }
- maintenanceNodes := sets.New[int32]()
- switch kind {
- case vmv1beta1.ClusterComponentSelect:
- maintenanceNodes.Insert(cr.Spec.VLStorage.MaintenanceSelectNodeIDs...)
- case vmv1beta1.ClusterComponentInsert:
- maintenanceNodes.Insert(cr.Spec.VLStorage.MaintenanceInsertNodeIDs...)
- default:
- panic("BUG unsupported kind: " + string(kind))
- }
- var replicaCount int32
- if cr.Spec.VLStorage.ReplicaCount != nil {
- replicaCount = *cr.Spec.VLStorage.ReplicaCount
- } else if cr.Spec.VLStorage.HPA != nil {
- replicaCount = cr.Spec.VLStorage.HPA.GetMinReplicas()
- }
- for i := int32(0); i < replicaCount; i++ {
- if maintenanceNodes.Has(i) {
- continue
- }
- result = append(result, i)
+ if cr.Spec.VLStorage == nil {
+ return nil
}
- return result
+ return vmv1beta1.AvailableStorageNodeIDs(kind, cr.Spec.VLStorage.ReplicaCount, cr.Spec.VLStorage.HPA,
+ cr.Spec.VLStorage.MaintenanceSelectNodeIDs, cr.Spec.VLStorage.MaintenanceInsertNodeIDs)
}
// LastSpecUpdated compares spec with last applied spec stored, replaces old spec and returns true if it's updated
@@ -873,53 +851,48 @@ func (cr *VLCluster) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
-// AsURL implements stub for interface.
+// Params implements vmv1beta1.ParentOpts interface: the appsParams for kind, or nil when
+// that component isn't configured.
// nolint:dupl,lll
-func (cr *VLCluster) AsURL(kind vmv1beta1.ClusterComponent, isExtra bool) string {
- var defaultPort string
- var svcSpec *vmv1beta1.AdditionalServiceSpec
- var extraArgs map[string]string
+func (cr *VLCluster) Params(kind vmv1beta1.ClusterComponent, pk vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
switch kind {
case vmv1beta1.ClusterComponentSelect:
if cr.Spec.VLSelect == nil {
- return ""
- }
- defaultPort = "9471"
- if cr.Spec.VLSelect.Port != "" {
- defaultPort = cr.Spec.VLSelect.Port
+ return nil
}
- svcSpec = cr.Spec.VLSelect.ServiceSpec
- extraArgs = cr.Spec.VLSelect.ExtraArgs
+ return cr.Spec.VLSelect.Params(pk)
case vmv1beta1.ClusterComponentInsert:
if cr.Spec.VLInsert == nil {
- return ""
- }
- defaultPort = "9481"
- if cr.Spec.VLInsert.Port != "" {
- defaultPort = cr.Spec.VLInsert.Port
+ return nil
}
- svcSpec = cr.Spec.VLInsert.ServiceSpec
- extraArgs = cr.Spec.VLInsert.ExtraArgs
+ return cr.Spec.VLInsert.Params(pk)
case vmv1beta1.ClusterComponentStorage:
if cr.Spec.VLStorage == nil {
- return ""
- }
- defaultPort = "9491"
- if cr.Spec.VLStorage.Port != "" {
- defaultPort = cr.Spec.VLStorage.Port
+ return nil
}
- svcSpec = cr.Spec.VLStorage.ServiceSpec
- extraArgs = cr.Spec.VLStorage.ExtraArgs
+ return cr.Spec.VLStorage.Params(pk)
default:
panic("BUG unsupported cluster kind=" + string(kind))
}
- svcName, port := vmv1beta1.ResolveServiceURL(cr.PrefixedName(kind), defaultPort, "http", svcSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", vmv1beta1.HTTPProtoFromFlags(extraArgs), svcName, cr.Namespace, port)
+}
+
+// AsURL returns the service URL for kind, or an empty string when that component isn't
+// configured. Returns an error when nsn.ListenerName doesn't match a configured listener.
+func (cr *VLCluster) AsURL(kind vmv1beta1.ClusterComponent, nsn vmv1beta1.NamespacedName) (string, error) {
+ params := cr.Params(kind, vmv1beta1.ServiceParamsKind)
+ if params == nil {
+ return "", nil
+ }
+ if nsn.ListenerName != "" && params.GetListener(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VLCluster=%q %s httpListeners", nsn.ListenerName, cr.Name, kind)
+ }
+ return vmv1beta1.BuildServiceURL(vmv1beta1.NewChildBuilder(cr, kind), nsn)
}
// GetRemoteWriteURL returns the insert URL for VLCluster (used by VLDistributed)
func (cr *VLCluster) GetRemoteWriteURL() string {
- return cr.AsURL(vmv1beta1.ClusterComponentInsert, false) + "/insert/native"
+ url, _ := cr.AsURL(vmv1beta1.ClusterComponentInsert, vmv1beta1.NamespacedName{})
+ return url + "/insert/native"
}
// +kubebuilder:object:root=true
diff --git a/api/operator/v1/vlsingle_types.go b/api/operator/v1/vlsingle_types.go
index 12925e14f1..77699f4b8d 100644
--- a/api/operator/v1/vlsingle_types.go
+++ b/api/operator/v1/vlsingle_types.go
@@ -19,7 +19,6 @@ package v1
import (
"encoding/json"
"fmt"
- "strings"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
@@ -41,7 +40,7 @@ type VLSingleSpec struct {
// created by operator for the given CustomResource
ManagedMetadata *vmv1beta1.ManagedObjectsMetadata `json:"managedMetadata,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline,omitempty"`
+ vmv1beta1.StandardAppsParams `json:",inline,omitempty"`
// LogLevel for VictoriaLogs to be configured with.
// +optional
@@ -172,7 +171,7 @@ func (cr *VLSingle) GetStatus() *VLSingleStatus {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VLSingle) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.Spec.ExtraArgs)
+ return cr.Spec.UseProxyProtocol()
}
// DefaultStatusFields implements reconcile.ObjectWithDeepCopyAndStatus interface
@@ -232,14 +231,6 @@ func (cr *VLSingle) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-func (cr *VLSingle) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-func (cr *VLSingle) ProbePort() string {
- return cr.Spec.Port
-}
-
func (cr *VLSingle) ProbeNeedLiveness() bool {
return false
}
@@ -301,7 +292,12 @@ func (cr *VLSingle) GetMetricsPath() string {
// UseTLS returns true if TLS is enabled
func (cr *VLSingle) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.Spec.ExtraArgs)
+ return cr.Spec.UseTLS()
+}
+
+// PrimaryPortName returns the Service port name generated for the primary listener.
+func (cr *VLSingle) PrimaryPortName() string {
+ return cr.Spec.PrimaryPortName()
}
// Validate checks if spec is correct
@@ -312,6 +308,9 @@ func (cr *VLSingle) Validate() error {
if cr.Spec.ServiceSpec != nil && cr.Spec.ServiceSpec.Name == cr.PrefixedName() {
return fmt.Errorf("spec.serviceSpec.Name cannot be equal to prefixed name=%q", cr.PrefixedName())
}
+ if err := cr.Spec.SyslogSpec.ValidateNoListenerNameCollision(cr.Spec.HTTPListeners); err != nil {
+ return err
+ }
if cr.Spec.VPA != nil {
if err := cr.Spec.VPA.Validate(); err != nil {
return err
@@ -345,13 +344,16 @@ func (cr *VLSingle) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
-func (cr *VLSingle) AsURL(isExtra bool) string {
- specPort := cr.Spec.Port
- if specPort == "" {
- specPort = "9428"
+// Params implements build.scrapeBuilder and urlBuilder interfaces
+func (cr *VLSingle) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &cr.Spec.StandardAppsParams
+}
+
+func (cr *VLSingle) AsURL(nsn vmv1beta1.NamespacedName) (string, error) {
+ if nsn.ListenerName != "" && cr.Spec.ByName(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VLSingle=%q httpListeners", nsn.ListenerName, cr.Name)
}
- svcName, port := vmv1beta1.ResolveServiceURL(cr.PrefixedName(), specPort, "http", cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs), svcName, cr.Namespace, port)
+ return vmv1beta1.BuildServiceURL(cr, nsn)
}
// LastSpecUpdated compares spec with last applied spec stored, replaces old spec and returns true if it's updated
@@ -372,5 +374,6 @@ func (cr *VLSingle) GetAdditionalService() *vmv1beta1.AdditionalServiceSpec {
// GetRemoteWriteURL returns the native insert URL for VLSingle (used by VLDistributed)
func (cr *VLSingle) GetRemoteWriteURL() string {
- return cr.AsURL(false) + "/insert/native"
+ url, _ := cr.AsURL(vmv1beta1.NamespacedName{})
+ return url + "/insert/native"
}
diff --git a/api/operator/v1/vmanomaly_types.go b/api/operator/v1/vmanomaly_types.go
index a7b8a6b807..e4d0e9f204 100644
--- a/api/operator/v1/vmanomaly_types.go
+++ b/api/operator/v1/vmanomaly_types.go
@@ -20,7 +20,6 @@ import (
"encoding/json"
"fmt"
"path"
- "strings"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
@@ -499,12 +498,8 @@ func (cr *VMAnomaly) ProbePath() string {
return healthPath
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VMAnomaly) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
+// ProbePort returns the monitoring port used both for the ProbeListener built by Params and for
+// the anomaly config's own monitoring.pull.port.
func (cr *VMAnomaly) ProbePort() string {
if cr == nil || cr.Spec.Monitoring == nil || cr.Spec.Monitoring.Pull == nil || len(cr.Spec.Monitoring.Pull.Port) == 0 {
return "8080"
@@ -517,11 +512,29 @@ func (*VMAnomaly) ProbeNeedLiveness() bool {
return true
}
+// Params implements build.scrapeBuilder and urlBuilder interfaces. VMAnomaly is scraped on its
+// separate monitoring port rather than its main service port.
+func (cr *VMAnomaly) Params(pk vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ if pk == vmv1beta1.ScrapeParamsKind {
+ return &vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ExtraArgs: cr.Spec.ExtraArgs},
+ HTTPListeners: []vmv1beta1.HTTPListener{{
+ Name: "monitoring-http",
+ Addr: ":" + cr.ProbePort(),
+ }},
+ }
+ }
+ return &vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: cr.Port(),
+ ExtraArgs: cr.Spec.ExtraArgs,
+ },
+ }
+}
+
// AsURL returns url for http access to the first replica.
-// Returns empty string if spec.server.port is not configured.
-func (cr *VMAnomaly) AsURL(isExtra bool) string {
- svcName, port := vmv1beta1.ResolveServiceURL(cr.PrefixedName(), cr.Port(), "http", nil, isExtra)
- return fmt.Sprintf("http://%s.%s.svc:%s", svcName, cr.Namespace, port)
+func (cr *VMAnomaly) AsURL(nsn vmv1beta1.NamespacedName) (string, error) {
+ return vmv1beta1.BuildServiceURL(cr, nsn)
}
// Validate performs semantic validation for component
diff --git a/api/operator/v1/vtagent_types.go b/api/operator/v1/vtagent_types.go
index 000a8b226b..eed4170652 100644
--- a/api/operator/v1/vtagent_types.go
+++ b/api/operator/v1/vtagent_types.go
@@ -19,7 +19,6 @@ package v1
import (
"encoding/json"
"fmt"
- "strings"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
@@ -107,8 +106,8 @@ type VTAgentSpec struct {
// Configures vertical pod autoscaling.
// +optional
- VPA *vmv1beta1.EmbeddedVPA `json:"vpa,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline,omitempty"`
+ VPA *vmv1beta1.EmbeddedVPA `json:"vpa,omitempty"`
+ vmv1beta1.StandardAppsParams `json:",inline,omitempty"`
}
// Validate performs syntax validation
@@ -142,7 +141,7 @@ func (cr *VTAgent) Validate() error {
if specPort == "" {
specPort = "10429"
}
- if err := cr.Spec.GRPCSpec.Validate(specPort); err != nil {
+ if err := cr.Spec.GRPCSpec.Validate(specPort, cr.Spec.HTTPListeners); err != nil {
return err
}
if err := cr.Spec.Validate(); err != nil {
@@ -153,7 +152,7 @@ func (cr *VTAgent) Validate() error {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VTAgent) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.Spec.ExtraArgs)
+ return cr.Spec.UseProxyProtocol()
}
// VTAgentRemoteWriteSettings - defines global settings for all remoteWrite urls.
@@ -393,7 +392,7 @@ func (cr *VTAgent) GetMetricsPath() string {
// UseTLS returns true if TLS is enabled
func (cr *VTAgent) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.Spec.ExtraArgs)
+ return cr.Spec.UseTLS()
}
// GetExtraArgs returns additionally configured command-line arguments
@@ -419,14 +418,17 @@ func (cr *VTAgent) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
+// Params implements build.scrapeBuilder and urlBuilder interfaces
+func (cr *VTAgent) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &cr.Spec.StandardAppsParams
+}
+
// AsURL - returns url for http access
-func (cr *VTAgent) AsURL(isExtra bool) string {
- specPort := cr.Spec.Port
- if specPort == "" {
- specPort = "10429"
+func (cr *VTAgent) AsURL(nsn vmv1beta1.NamespacedName) (string, error) {
+ if nsn.ListenerName != "" && cr.Spec.ByName(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VTAgent=%q httpListeners", nsn.ListenerName, cr.Name)
}
- svcName, port := vmv1beta1.ResolveServiceURL(cr.PrefixedName(), specPort, "http", cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs), svcName, cr.Namespace, port)
+ return vmv1beta1.BuildServiceURL(cr, nsn)
}
// ProbePath implements build.probeCRD interface
@@ -434,14 +436,9 @@ func (cr *VTAgent) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VTAgent) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VTAgent) ProbePort() string {
- return cr.Spec.Port
+// PrimaryPortName returns the Service port name generated for the primary listener.
+func (cr *VTAgent) PrimaryPortName() string {
+ return cr.Spec.PrimaryPortName()
}
// ProbeNeedLiveness implements build.probeCRD interface
diff --git a/api/operator/v1/vtcluster_types.go b/api/operator/v1/vtcluster_types.go
index 5b07ff25fc..ba0c322206 100644
--- a/api/operator/v1/vtcluster_types.go
+++ b/api/operator/v1/vtcluster_types.go
@@ -266,12 +266,17 @@ type VTInsert struct {
// +optional
RollingUpdate *appsv1.RollingUpdateDeployment `json:"rollingUpdate,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline"`
+ vmv1beta1.StandardAppsParams `json:",inline"`
+}
+
+// Params implements build.scrapeBuilder interface
+func (p *VTInsert) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &p.StandardAppsParams
}
// UseProxyProtocol implements build.probeCRD interface
func (cr *VTInsert) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
+ return cr.StandardAppsParams.UseProxyProtocol()
}
// ProbePath implements build.probeCRD interface
@@ -279,16 +284,6 @@ func (cr *VTInsert) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VTInsert) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VTInsert) ProbePort() string {
- return cr.Port
-}
-
// ProbeNeedLiveness implements build.probeCRD interface
func (*VTInsert) ProbeNeedLiveness() bool {
return true
@@ -307,11 +302,6 @@ func (cr *VTInsert) GetExtraArgs() map[string]string {
return cr.ExtraArgs
}
-// UseTLS returns true if TLS is enabled
-func (cr *VTInsert) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.ExtraArgs)
-}
-
// ServiceScrape returns overrides for serviceScrape builder
func (cr *VTInsert) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
@@ -374,7 +364,12 @@ type VTSelect struct {
// ExtraStorageNodes - defines additional storage nodes to VTSelect
ExtraStorageNodes []VTStorageNode `json:"extraStorageNodes,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline"`
+ vmv1beta1.StandardAppsParams `json:",inline"`
+}
+
+// Params implements build.scrapeBuilder interface
+func (p *VTSelect) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &p.StandardAppsParams
}
// GetMetricsPath returns prefixed path for metric requests
@@ -387,7 +382,7 @@ func (cr *VTSelect) GetMetricsPath() string {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VTSelect) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
+ return cr.StandardAppsParams.UseProxyProtocol()
}
// ExtraArgs returns additionally configured command-line arguments
@@ -395,11 +390,6 @@ func (cr *VTSelect) GetExtraArgs() map[string]string {
return cr.ExtraArgs
}
-// UseTLS returns true if TLS is enabled
-func (cr *VTSelect) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.ExtraArgs)
-}
-
// ServiceScrape returns overrides for serviceScrape builder
func (cr *VTSelect) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
@@ -410,16 +400,6 @@ func (cr *VTSelect) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VTSelect) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VTSelect) ProbePort() string {
- return cr.Port
-}
-
// ProbeNeedLiveness implements build.probeCRD interface
func (*VTSelect) ProbeNeedLiveness() bool {
return true
@@ -518,7 +498,7 @@ type VTStorage struct {
// +optional
MaintenanceSelectNodeIDs []int32 `json:"maintenanceSelectNodeIDs,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline"`
+ vmv1beta1.StandardAppsParams `json:",inline"`
// RollingUpdateStrategyBehavior defines customized behavior for rolling updates.
// It applies if the RollingUpdateStrategy is set to OnDelete, which is the default.
@@ -536,7 +516,12 @@ func (cr *VTStorage) GetStorageVolumeName() string {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VTStorage) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
+ return cr.StandardAppsParams.UseProxyProtocol()
+}
+
+// Params implements build.scrapeBuilder interface
+func (cr *VTStorage) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &cr.StandardAppsParams
}
// GetMetricsPath returns prefixed path for metric requests
@@ -552,11 +537,6 @@ func (cr *VTStorage) GetExtraArgs() map[string]string {
return cr.ExtraArgs
}
-// UseTLS returns true if TLS is enabled
-func (cr *VTStorage) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.ExtraArgs)
-}
-
// ServiceScrape returns overrides for serviceScrape builder
func (cr *VTStorage) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
@@ -567,16 +547,6 @@ func (cr *VTStorage) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VTStorage) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VTStorage) ProbePort() string {
- return cr.Port
-}
-
// ProbeNeedLiveness implements build.probeCRD interface
func (*VTStorage) ProbeNeedLiveness() bool {
return false
@@ -665,7 +635,7 @@ func (cr *VTCluster) Validate() error {
if vti.Port != "" {
insertPort = vti.Port
}
- if err := vti.GRPCSpec.Validate(insertPort); err != nil {
+ if err := vti.GRPCSpec.Validate(insertPort, vti.HTTPListeners); err != nil {
return fmt.Errorf("insert: %w", err)
}
if err := vti.Validate(); err != nil {
@@ -674,7 +644,11 @@ func (cr *VTCluster) Validate() error {
}
storageNodes := sets.New[string]()
if cr.Spec.Storage != nil {
- storageNodes.Insert(cr.AsURL(vmv1beta1.ClusterComponentStorage, false))
+ storageURL, err := cr.AsURL(vmv1beta1.ClusterComponentStorage, vmv1beta1.NamespacedName{})
+ if err != nil {
+ return fmt.Errorf("storage: %w", err)
+ }
+ storageNodes.Insert(storageURL)
vts := cr.Spec.Storage
name := cr.PrefixedName(vmv1beta1.ClusterComponentStorage)
if vts.ServiceSpec != nil && vts.ServiceSpec.Name == name {
@@ -742,32 +716,11 @@ func (cr *VTCluster) Validate() error {
// AvailableStorageNodeIDs returns ids of the storage nodes for the provided component
func (cr *VTCluster) AvailableStorageNodeIDs(kind vmv1beta1.ClusterComponent) []int32 {
- var result []int32
- if cr.Spec.Storage == nil || (cr.Spec.Storage.ReplicaCount == nil && cr.Spec.Storage.HPA == nil) {
- return result
- }
- maintenanceNodes := sets.New[int32]()
- switch kind {
- case vmv1beta1.ClusterComponentSelect:
- maintenanceNodes.Insert(cr.Spec.Storage.MaintenanceSelectNodeIDs...)
- case vmv1beta1.ClusterComponentInsert:
- maintenanceNodes.Insert(cr.Spec.Storage.MaintenanceInsertNodeIDs...)
- default:
- panic("BUG unsupported kind: " + string(kind))
- }
- var replicaCount int32
- if cr.Spec.Storage.ReplicaCount != nil {
- replicaCount = *cr.Spec.Storage.ReplicaCount
- } else if cr.Spec.Storage.HPA != nil {
- replicaCount = cr.Spec.Storage.HPA.GetMinReplicas()
- }
- for i := int32(0); i < replicaCount; i++ {
- if maintenanceNodes.Has(i) {
- continue
- }
- result = append(result, i)
+ if cr.Spec.Storage == nil {
+ return nil
}
- return result
+ return vmv1beta1.AvailableStorageNodeIDs(kind, cr.Spec.Storage.ReplicaCount, cr.Spec.Storage.HPA,
+ cr.Spec.Storage.MaintenanceSelectNodeIDs, cr.Spec.Storage.MaintenanceInsertNodeIDs)
}
// LastSpecUpdated compares spec with last applied spec stored, replaces old spec and returns true if it's updated
@@ -794,48 +747,42 @@ func (cr *VTCluster) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
-// AsURL implements stub for interface.
// nolint:dupl,lll
-func (cr *VTCluster) AsURL(kind vmv1beta1.ClusterComponent, isExtra bool) string {
- var defaultPort string
- var svcSpec *vmv1beta1.AdditionalServiceSpec
- var extraArgs map[string]string
+// Params implements vmv1beta1.ParentOpts interface: the AppsParams for kind, or nil when
+// that component isn't configured.
+func (cr *VTCluster) Params(kind vmv1beta1.ClusterComponent, pk vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
switch kind {
case vmv1beta1.ClusterComponentSelect:
if cr.Spec.Select == nil {
- return ""
- }
- defaultPort = "10471"
- if cr.Spec.Select.Port != "" {
- defaultPort = cr.Spec.Select.Port
+ return nil
}
- svcSpec = cr.Spec.Select.ServiceSpec
- extraArgs = cr.Spec.Select.ExtraArgs
+ return cr.Spec.Select.Params(pk)
case vmv1beta1.ClusterComponentInsert:
if cr.Spec.Insert == nil {
- return ""
- }
- defaultPort = "10481"
- if cr.Spec.Insert.Port != "" {
- defaultPort = cr.Spec.Insert.Port
+ return nil
}
- svcSpec = cr.Spec.Insert.ServiceSpec
- extraArgs = cr.Spec.Insert.ExtraArgs
+ return cr.Spec.Insert.Params(pk)
case vmv1beta1.ClusterComponentStorage:
if cr.Spec.Storage == nil {
- return ""
- }
- defaultPort = "10491"
- if cr.Spec.Storage.Port != "" {
- defaultPort = cr.Spec.Storage.Port
+ return nil
}
- svcSpec = cr.Spec.Storage.ServiceSpec
- extraArgs = cr.Spec.Storage.ExtraArgs
+ return cr.Spec.Storage.Params(pk)
default:
panic("BUG unsupported cluster kind=" + string(kind))
}
- svcName, port := vmv1beta1.ResolveServiceURL(cr.PrefixedName(kind), defaultPort, "http", svcSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", vmv1beta1.HTTPProtoFromFlags(extraArgs), svcName, cr.Namespace, port)
+}
+
+// AsURL returns the service URL for kind, or an empty string when that component isn't
+// configured. Returns an error when nsn.ListenerName doesn't match a configured listener.
+func (cr *VTCluster) AsURL(kind vmv1beta1.ClusterComponent, nsn vmv1beta1.NamespacedName) (string, error) {
+ params := cr.Params(kind, vmv1beta1.ServiceParamsKind)
+ if params == nil {
+ return "", nil
+ }
+ if nsn.ListenerName != "" && params.GetListener(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VTCluster=%q %s httpListeners", nsn.ListenerName, cr.Name, kind)
+ }
+ return vmv1beta1.BuildServiceURL(vmv1beta1.NewChildBuilder(cr, kind), nsn)
}
// +kubebuilder:object:root=true
diff --git a/api/operator/v1/vtsingle_types.go b/api/operator/v1/vtsingle_types.go
index a7b018db4f..f0c3baa519 100644
--- a/api/operator/v1/vtsingle_types.go
+++ b/api/operator/v1/vtsingle_types.go
@@ -19,7 +19,6 @@ package v1
import (
"encoding/json"
"fmt"
- "strings"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
@@ -41,7 +40,7 @@ type VTSingleSpec struct {
// created by operator for the given CustomResource
ManagedMetadata *vmv1beta1.ManagedObjectsMetadata `json:"managedMetadata,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline,omitempty"`
+ vmv1beta1.StandardAppsParams `json:",inline,omitempty"`
// LogLevel for VictoriaTraces to be configured with.
// +optional
@@ -226,16 +225,6 @@ func (cr *VTSingle) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-// ProbeScheme implements build.probeCRD interface
-func (cr *VTSingle) ProbeScheme() string {
- return strings.ToUpper(vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-// ProbePort implements build.probeCRD interface
-func (cr *VTSingle) ProbePort() string {
- return cr.Spec.Port
-}
-
// ProbeNeedLiveness implements build.probeCRD interface
func (cr *VTSingle) ProbeNeedLiveness() bool {
return false
@@ -299,7 +288,12 @@ func (cr *VTSingle) GetMetricsPath() string {
// UseTLS returns true if TLS is enabled
func (cr *VTSingle) UseTLS() bool {
- return vmv1beta1.UseTLS(cr.Spec.ExtraArgs)
+ return cr.Spec.UseTLS()
+}
+
+// PrimaryPortName returns the Service port name generated for the primary listener.
+func (cr *VTSingle) PrimaryPortName() string {
+ return cr.Spec.PrimaryPortName()
}
// Validate checks if spec is correct
@@ -319,7 +313,7 @@ func (cr *VTSingle) Validate() error {
if specPort == "" {
specPort = "10428"
}
- if err := cr.Spec.GRPCSpec.Validate(specPort); err != nil {
+ if err := cr.Spec.GRPCSpec.Validate(specPort, cr.Spec.HTTPListeners); err != nil {
return err
}
if err := cr.Spec.Validate(); err != nil {
@@ -351,14 +345,17 @@ func (cr *VTSingle) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
+// Params implements build.scrapeBuilder and urlBuilder interfaces
+func (cr *VTSingle) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &cr.Spec.StandardAppsParams
+}
+
// AsURL returns URL for components access
-func (cr *VTSingle) AsURL(isExtra bool) string {
- specPort := cr.Spec.Port
- if specPort == "" {
- specPort = "10428"
+func (cr *VTSingle) AsURL(nsn vmv1beta1.NamespacedName) (string, error) {
+ if nsn.ListenerName != "" && cr.Spec.ByName(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VTSingle=%q httpListeners", nsn.ListenerName, cr.Name)
}
- svcName, port := vmv1beta1.ResolveServiceURL(cr.PrefixedName(), specPort, "http", cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs), svcName, cr.Namespace, port)
+ return vmv1beta1.BuildServiceURL(cr, nsn)
}
// LastSpecUpdated compares spec with last applied spec stored, replaces old spec and returns true if it's updated
@@ -370,7 +367,7 @@ func (cr *VTSingle) LastSpecUpdated() bool {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VTSingle) UseProxyProtocol() bool {
- return vmv1beta1.UseProxyProtocol(cr.Spec.ExtraArgs)
+ return cr.Spec.UseProxyProtocol()
}
func (cr *VTSingle) Paused() bool {
diff --git a/api/operator/v1/zz_generated.deepcopy.go b/api/operator/v1/zz_generated.deepcopy.go
index 2fc12976a0..64a7a7b7c6 100644
--- a/api/operator/v1/zz_generated.deepcopy.go
+++ b/api/operator/v1/zz_generated.deepcopy.go
@@ -524,7 +524,7 @@ func (in *VLAgentSpec) DeepCopyInto(out *VLAgentSpec) {
*out = new(v1beta1.EmbeddedVPA)
(*in).DeepCopyInto(*out)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLAgentSpec.
@@ -742,7 +742,7 @@ func (in *VLInsert) DeepCopyInto(out *VLInsert) {
*out = new(appsv1.RollingUpdateDeployment)
(*in).DeepCopyInto(*out)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLInsert.
@@ -808,7 +808,7 @@ func (in *VLSelect) DeepCopyInto(out *VLSelect) {
*out = make([]VLStorageNode, len(*in))
copy(*out, *in)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLSelect.
@@ -893,7 +893,7 @@ func (in *VLSingleSpec) DeepCopyInto(out *VLSingleSpec) {
*out = new(v1beta1.ManagedObjectsMetadata)
(*in).DeepCopyInto(*out)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
if in.Storage != nil {
in, out := &in.Storage, &out.Storage
*out = new(corev1.PersistentVolumeClaimSpec)
@@ -1028,7 +1028,7 @@ func (in *VLStorage) DeepCopyInto(out *VLStorage) {
*out = make([]int32, len(*in))
copy(*out, *in)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
if in.RollingUpdateStrategyBehavior != nil {
in, out := &in.RollingUpdateStrategyBehavior, &out.RollingUpdateStrategyBehavior
*out = new(v1beta1.StatefulSetUpdateStrategyBehavior)
@@ -1743,7 +1743,7 @@ func (in *VTAgentSpec) DeepCopyInto(out *VTAgentSpec) {
*out = new(v1beta1.EmbeddedVPA)
(*in).DeepCopyInto(*out)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VTAgentSpec.
@@ -1956,7 +1956,7 @@ func (in *VTInsert) DeepCopyInto(out *VTInsert) {
*out = new(appsv1.RollingUpdateDeployment)
(*in).DeepCopyInto(*out)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VTInsert.
@@ -2022,7 +2022,7 @@ func (in *VTSelect) DeepCopyInto(out *VTSelect) {
*out = make([]VTStorageNode, len(*in))
copy(*out, *in)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VTSelect.
@@ -2107,7 +2107,7 @@ func (in *VTSingleSpec) DeepCopyInto(out *VTSingleSpec) {
*out = new(v1beta1.ManagedObjectsMetadata)
(*in).DeepCopyInto(*out)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
if in.Storage != nil {
in, out := &in.Storage, &out.Storage
*out = new(corev1.PersistentVolumeClaimSpec)
@@ -2237,7 +2237,7 @@ func (in *VTStorage) DeepCopyInto(out *VTStorage) {
*out = make([]int32, len(*in))
copy(*out, *in)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
if in.RollingUpdateStrategyBehavior != nil {
in, out := &in.RollingUpdateStrategyBehavior, &out.RollingUpdateStrategyBehavior
*out = new(v1beta1.StatefulSetUpdateStrategyBehavior)
diff --git a/api/operator/v1alpha1/vldistributed_types.go b/api/operator/v1alpha1/vldistributed_types.go
index dfacd325a4..d7602976ed 100644
--- a/api/operator/v1alpha1/vldistributed_types.go
+++ b/api/operator/v1alpha1/vldistributed_types.go
@@ -263,7 +263,7 @@ type VLDistributedZoneAgentSpec struct {
// +optional
VPA *vmv1beta1.EmbeddedVPA `json:"vpa,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline,omitempty"`
+ vmv1beta1.StandardAppsParams `json:",inline,omitempty"`
}
// ToVLAgentSpec converts VLDistributedZoneAgentSpec to vmv1.VLAgentSpec via JSON round-trip.
@@ -531,6 +531,12 @@ func (cr *VLDistributed) Validate() error {
}
agents.Insert(agentName)
}
+ if err := zone.VLAgent.Spec.Validate(); err != nil {
+ return fmt.Errorf("spec.zones[%d].vlagent.spec: %w", i, err)
+ }
+ }
+ if err := cr.Spec.ZoneCommon.VLAgent.Spec.Validate(); err != nil {
+ return fmt.Errorf("spec.zoneCommon.vlagent.spec: %w", err)
}
return nil
}
diff --git a/api/operator/v1alpha1/vmdistributed_types.go b/api/operator/v1alpha1/vmdistributed_types.go
index 369f077afe..c777668d2e 100644
--- a/api/operator/v1alpha1/vmdistributed_types.go
+++ b/api/operator/v1alpha1/vmdistributed_types.go
@@ -283,7 +283,7 @@ type VMDistributedZoneAgentSpec struct {
// +optional
HPA *vmv1beta1.EmbeddedHPA `json:"hpa,omitempty"`
- vmv1beta1.CommonAppsParams `json:",inline,omitempty"`
+ vmv1beta1.StandardAppsParams `json:",inline,omitempty"`
}
func (s *VMDistributedZoneAgentSpec) ToVMAgentSpec() (*vmv1beta1.VMAgentSpec, error) {
@@ -574,6 +574,12 @@ func (cr *VMDistributed) Validate() error {
}
}
}
+ if err := zone.VMAgent.Spec.Validate(); err != nil {
+ return fmt.Errorf("spec.zones[%d].vmagent.spec: %w", i, err)
+ }
+ }
+ if err := cr.Spec.ZoneCommon.VMAgent.Spec.Validate(); err != nil {
+ return fmt.Errorf("spec.zoneCommon.vmagent.spec: %w", err)
}
return nil
}
diff --git a/api/operator/v1alpha1/zz_generated.deepcopy.go b/api/operator/v1alpha1/zz_generated.deepcopy.go
index 4d333456c8..cb96e34622 100644
--- a/api/operator/v1alpha1/zz_generated.deepcopy.go
+++ b/api/operator/v1alpha1/zz_generated.deepcopy.go
@@ -248,7 +248,7 @@ func (in *VLDistributedZoneAgentSpec) DeepCopyInto(out *VLDistributedZoneAgentSp
*out = new(v1beta1.EmbeddedVPA)
(*in).DeepCopyInto(*out)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLDistributedZoneAgentSpec.
@@ -598,7 +598,7 @@ func (in *VMDistributedZoneAgentSpec) DeepCopyInto(out *VMDistributedZoneAgentSp
*out = new(v1beta1.EmbeddedHPA)
(*in).DeepCopyInto(*out)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMDistributedZoneAgentSpec.
diff --git a/api/operator/v1beta1/vlogs_types.go b/api/operator/v1beta1/vlogs_types.go
index 38bd094d5d..94cf9d0561 100644
--- a/api/operator/v1beta1/vlogs_types.go
+++ b/api/operator/v1beta1/vlogs_types.go
@@ -19,7 +19,6 @@ package v1beta1
import (
"encoding/json"
"fmt"
- "strings"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
@@ -41,7 +40,7 @@ type VLogsSpec struct {
// created by operator for the given CustomResource
ManagedMetadata *ManagedObjectsMetadata `json:"managedMetadata,omitempty"`
- CommonAppsParams `json:",inline,omitempty"`
+ CommonAppsParams `json:",inline"`
// LogLevel for VictoriaLogs to be configured with.
// +optional
@@ -199,14 +198,6 @@ func (cr *VLogs) ProbePath() string {
return BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-func (cr *VLogs) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-func (cr *VLogs) ProbePort() string {
- return cr.Spec.Port
-}
-
func (cr *VLogs) ProbeNeedLiveness() bool {
return false
}
@@ -299,13 +290,15 @@ func (cr *VLogs) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
-func (cr *VLogs) AsURL(isExtra bool) string {
- specPort := cr.Spec.Port
- if specPort == "" {
- specPort = "9428"
+// Params implements urlBuilder interface
+func (cr *VLogs) Params(ParamsKind) *StandardAppsParams {
+ return &StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{Port: cr.Spec.Port, ExtraArgs: cr.Spec.ExtraArgs},
}
- svcName, port := ResolveServiceURL(cr.PrefixedName(), specPort, "http", cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", HTTPProtoFromFlags(cr.Spec.ExtraArgs), svcName, cr.Namespace, port)
+}
+
+func (cr *VLogs) AsURL(nsn NamespacedName) (string, error) {
+ return BuildServiceURL(cr, nsn)
}
// LastSpecUpdated compares spec with last applied spec stored, replaces old spec and returns true if it's updated
diff --git a/api/operator/v1beta1/vmagent_types.go b/api/operator/v1beta1/vmagent_types.go
index 8c2e295266..73066f57bc 100644
--- a/api/operator/v1beta1/vmagent_types.go
+++ b/api/operator/v1beta1/vmagent_types.go
@@ -152,7 +152,7 @@ type VMAgentSpec struct {
CommonRelabelParams `json:",inline,omitempty"`
CommonScrapeParams `json:",inline,omitempty"`
CommonConfigReloaderParams `json:",inline,omitempty"`
- CommonAppsParams `json:",inline,omitempty"`
+ StandardAppsParams `json:",inline"`
}
func (cr *VMAgent) Validate() error {
@@ -162,6 +162,9 @@ func (cr *VMAgent) Validate() error {
if cr.Spec.ServiceSpec != nil && cr.Spec.ServiceSpec.Name == cr.PrefixedName() {
return fmt.Errorf("spec.serviceSpec.Name cannot be equal to prefixed name=%q", cr.PrefixedName())
}
+ if err := cr.Spec.InsertPorts.ValidateNoListenerNameCollision(cr.Spec.HTTPListeners); err != nil {
+ return err
+ }
if len(cr.Spec.RemoteWrite) == 0 {
return fmt.Errorf("spec.remoteWrite cannot be empty array, provide at least one remoteWrite")
}
@@ -287,7 +290,7 @@ func (cr *VMAgent) ExternalLabels() map[string]string {
// GetReloadURL implements reloadable interface
func (cr *VMAgent) GetReloadURL(host string) string {
- return BuildLocalURL(reloadAuthKeyFlag, host, cr.Spec.Port, reloadPath, cr.Spec.ExtraArgs)
+ return cr.Spec.BuildLocalURL(reloadAuthKeyFlag, host, reloadPath)
}
// GetReloaderParams implements reloadable interface
@@ -297,7 +300,7 @@ func (cr *VMAgent) GetReloaderParams() *CommonConfigReloaderParams {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VMAgent) UseProxyProtocol() bool {
- return UseProxyProtocol(cr.Spec.ExtraArgs)
+ return cr.Spec.UseProxyProtocol()
}
// AutomountServiceAccountToken implements reloadable interface
@@ -586,7 +589,12 @@ func (cr *VMAgent) GetMetricsPath() string {
// UseTLS returns true if TLS is enabled
func (cr *VMAgent) UseTLS() bool {
- return UseTLS(cr.Spec.ExtraArgs)
+ return cr.Spec.UseTLS()
+}
+
+// PrimaryPortName returns the Service port name generated for the primary listener.
+func (cr *VMAgent) PrimaryPortName() string {
+ return cr.Spec.PrimaryPortName()
}
// ExtraArgs returns additionally configured command-line arguments
@@ -615,28 +623,23 @@ func (cr *VMAgent) GetRBACName() string {
return fmt.Sprintf("monitoring:%s:%s", cr.Namespace, cr.PrefixedName())
}
+// Params implements build.scrapeBuilder and urlBuilder interfaces
+func (cr *VMAgent) Params(ParamsKind) *StandardAppsParams {
+ return &cr.Spec.StandardAppsParams
+}
+
// AsURL - returns url for http access
-func (cr *VMAgent) AsURL(isExtra bool) string {
- specPort := cr.Spec.Port
- if specPort == "" {
- specPort = "8429"
+func (cr *VMAgent) AsURL(nsn NamespacedName) (string, error) {
+ if nsn.ListenerName != "" && cr.Spec.ByName(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VMAgent=%q httpListeners", nsn.ListenerName, cr.Name)
}
- svcName, port := ResolveServiceURL(cr.PrefixedName(), specPort, "http", cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", HTTPProtoFromFlags(cr.Spec.ExtraArgs), svcName, cr.Namespace, port)
+ return BuildServiceURL(cr, nsn)
}
func (cr *VMAgent) ProbePath() string {
return BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-func (cr *VMAgent) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-func (cr *VMAgent) ProbePort() string {
- return cr.Spec.Port
-}
-
func (*VMAgent) ProbeNeedLiveness() bool {
return true
}
diff --git a/api/operator/v1beta1/vmagent_types_test.go b/api/operator/v1beta1/vmagent_types_test.go
index 6812f8416c..4708a799c7 100644
--- a/api/operator/v1beta1/vmagent_types_test.go
+++ b/api/operator/v1beta1/vmagent_types_test.go
@@ -149,7 +149,15 @@ func TestVMAgent_DefaultStatusFields(t *testing.T) {
f(&VMAgent{Spec: VMAgentSpec{ShardCount: ptr.To(int32(3)), DaemonSetMode: true}}, 1, 0)
// replicaCount is tracked independently
- f(&VMAgent{Spec: VMAgentSpec{CommonAppsParams: CommonAppsParams{ReplicaCount: ptr.To(int32(2))}}}, 1, 2)
+ f(&VMAgent{
+ Spec: VMAgentSpec{
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
+ },
+ }, 1, 2)
}
func TestVMAgent_PrefixedName(t *testing.T) {
diff --git a/api/operator/v1beta1/vmalert_types.go b/api/operator/v1beta1/vmalert_types.go
index e1c2b94cdb..940f5a90be 100644
--- a/api/operator/v1beta1/vmalert_types.go
+++ b/api/operator/v1beta1/vmalert_types.go
@@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"net/url"
- "strings"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
@@ -166,12 +165,12 @@ type VMAlertSpec struct {
ComponentVersion string `json:"componentVersion,omitempty"`
CommonConfigReloaderParams `json:",inline,omitempty"`
- CommonAppsParams `json:",inline,omitempty"`
+ StandardAppsParams `json:",inline"`
}
// GetReloadURL implements reloadable interface
func (cr *VMAlert) GetReloadURL(host string) string {
- return BuildLocalURL(reloadAuthKeyFlag, host, cr.Spec.Port, reloadPath, cr.Spec.ExtraArgs)
+ return cr.Spec.BuildLocalURL(reloadAuthKeyFlag, host, reloadPath)
}
// GetReloaderParams implements reloadable interface
@@ -181,7 +180,7 @@ func (cr *VMAlert) GetReloaderParams() *CommonConfigReloaderParams {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VMAlert) UseProxyProtocol() bool {
- return UseProxyProtocol(cr.Spec.ExtraArgs)
+ return cr.Spec.UseProxyProtocol()
}
// AutomountServiceAccountToken implements reloadable interface
@@ -332,14 +331,6 @@ func (cr *VMAlert) ProbePath() string {
return BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-func (cr *VMAlert) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-func (cr *VMAlert) ProbePort() string {
- return cr.Spec.Port
-}
-
func (*VMAlert) ProbeNeedLiveness() bool {
return true
}
@@ -473,7 +464,12 @@ func (cr *VMAlert) GetMetricsPath() string {
// UseTLS returns true if TLS is enabled
func (cr *VMAlert) UseTLS() bool {
- return UseTLS(cr.Spec.ExtraArgs)
+ return cr.Spec.UseTLS()
+}
+
+// PrimaryPortName returns the Service port name generated for the primary listener.
+func (cr *VMAlert) PrimaryPortName() string {
+ return cr.Spec.PrimaryPortName()
}
// GetExtraArgs returns additionally configured command-line arguments
@@ -519,13 +515,16 @@ func (cr *VMAlert) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
-func (cr *VMAlert) AsURL(isExtra bool) string {
- specPort := cr.Spec.Port
- if specPort == "" {
- specPort = "8080"
+// Params implements build.scrapeBuilder and urlBuilder interfaces
+func (cr *VMAlert) Params(ParamsKind) *StandardAppsParams {
+ return &cr.Spec.StandardAppsParams
+}
+
+func (cr *VMAlert) AsURL(nsn NamespacedName) (string, error) {
+ if nsn.ListenerName != "" && cr.Spec.ByName(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VMAlert=%q httpListeners", nsn.ListenerName, cr.Name)
}
- svcName, port := ResolveServiceURL(cr.PrefixedName(), specPort, "http", cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", HTTPProtoFromFlags(cr.Spec.ExtraArgs), svcName, cr.Namespace, port)
+ return BuildServiceURL(cr, nsn)
}
// IsUnmanaged checks if object should managed any config objects
diff --git a/api/operator/v1beta1/vmalert_types_test.go b/api/operator/v1beta1/vmalert_types_test.go
index ac9ebc6b1e..31cac5e8f2 100644
--- a/api/operator/v1beta1/vmalert_types_test.go
+++ b/api/operator/v1beta1/vmalert_types_test.go
@@ -22,8 +22,10 @@ func TestVMAlert_ValidateOk(t *testing.T) {
}
f(VMAlertSpec{
Datasource: VMAlertDatasourceSpec{URL: "http://some-url"},
- CommonAppsParams: CommonAppsParams{
- ExtraArgs: map[string]string{"notifier.blackhole": "true"},
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{
+ ExtraArgs: map[string]string{"notifier.blackhole": "true"},
+ },
},
})
diff --git a/api/operator/v1beta1/vmalertmanager_types.go b/api/operator/v1beta1/vmalertmanager_types.go
index bbe5b34273..9844d3b6ad 100644
--- a/api/operator/v1beta1/vmalertmanager_types.go
+++ b/api/operator/v1beta1/vmalertmanager_types.go
@@ -3,9 +3,9 @@ package v1beta1
import (
"encoding/json"
"fmt"
+ "maps"
"net/url"
"path"
- "strings"
amparse "github.com/prometheus/alertmanager/matcher/parse"
appsv1 "k8s.io/api/apps/v1"
@@ -13,6 +13,7 @@ import (
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
+ "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/ptr"
)
@@ -231,7 +232,7 @@ type VMAlertmanagerSpec struct {
VPA *EmbeddedVPA `json:"vpa,omitempty"`
CommonConfigReloaderParams `json:",inline,omitempty"`
- CommonAppsParams `json:",inline,omitempty"`
+ CommonAppsParams `json:",inline"`
}
// GetReloadURL implements reloadable interface
@@ -405,15 +406,25 @@ func (cr *VMAlertmanager) Port() string {
return port
}
-// AsURL returns url for accessing alertmanager
-// via corresponding service
-func (cr *VMAlertmanager) AsURL(isExtra bool) string {
- portName := cr.Spec.PortName
- if portName == "" {
- portName = "web"
+// Params implements build.scrapeBuilder and urlBuilder interfaces.
+func (cr *VMAlertmanager) Params(ParamsKind) *StandardAppsParams {
+ extraArgs := cr.Spec.ExtraArgs
+ if cr.Spec.WebConfig != nil && cr.Spec.WebConfig.TLSServerConfig != nil {
+ extraArgs = maps.Clone(extraArgs)
+ if extraArgs == nil {
+ extraArgs = map[string]string{}
+ }
+ extraArgs[tlsFlag] = "true"
+ }
+ return &StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{Port: cr.Port(), ExtraArgs: extraArgs},
+ HTTPListeners: []HTTPListener{{Name: cr.Spec.PortName, Addr: ":" + cr.Port()}},
}
- svcName, port := ResolveServiceURL(cr.PrefixedName(), cr.Port(), portName, cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", cr.accessScheme(), svcName, cr.Namespace, port)
+}
+
+// AsURL returns url for accessing alertmanager via corresponding service
+func (cr *VMAlertmanager) AsURL(nsn NamespacedName) (string, error) {
+ return BuildServiceURL(cr, nsn)
}
// returns fqdn for direct pod access
@@ -475,13 +486,13 @@ func (cr *VMAlertmanager) ProbePath() string {
return path.Clean(webRoutePrefix + "/-/healthy")
}
-func (cr *VMAlertmanager) ProbePort() string {
- return cr.Spec.PortName
+func (*VMAlertmanager) ProbeNeedLiveness() bool {
+ return true
}
-// ProbeScheme returns scheme for probe
-func (cr *VMAlertmanager) ProbeScheme() string {
- return strings.ToUpper(cr.accessScheme())
+// ProbePort implements build.probeCRDWithNamedPort interface
+func (cr *VMAlertmanager) ProbePort() intstr.IntOrString {
+ return intstr.FromString(cr.Spec.PortName)
}
func (cr *VMAlertmanager) accessScheme() string {
@@ -491,10 +502,6 @@ func (cr *VMAlertmanager) accessScheme() string {
return "http"
}
-func (*VMAlertmanager) ProbeNeedLiveness() bool {
- return true
-}
-
// IsUnmanaged checks if alertmanager should managed any alertmanager config objects
func (cr *VMAlertmanager) IsUnmanaged() bool {
if !cr.DeletionTimestamp.IsZero() || (cr.Status.ParsingSpecError != "" && !HasUnknownFields(cr.Status.ParsingSpecError)) {
diff --git a/api/operator/v1beta1/vmauth_types.go b/api/operator/v1beta1/vmauth_types.go
index dbdf9e90e6..2ae12b9186 100644
--- a/api/operator/v1beta1/vmauth_types.go
+++ b/api/operator/v1beta1/vmauth_types.go
@@ -142,7 +142,7 @@ type VMAuthSpec struct {
WaitForConfigReload *bool `json:"waitForConfigReload,omitempty"`
CommonConfigReloaderParams `json:",inline,omitempty" yaml:",inline"`
- CommonAppsParams `json:",inline,omitempty" yaml:",inline"`
+ StandardAppsParams `json:",inline,omitempty" yaml:",inline"`
// InternalListenPort instructs vmauth to serve internal routes at given port
// available from v1.111.0 vmauth version
// related doc https://docs.victoriametrics.com/victoriametrics/vmauth/#security
@@ -152,6 +152,7 @@ type VMAuthSpec struct {
// UseProxyProtocol enables proxy protocol for vmauth
// https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt
+ // +notes={deprecated_in: "v0.74.0", replacements: {httpListeners}}
UseProxyProtocol bool `json:"useProxyProtocol,omitempty"`
// UpdateStrategy - overrides default update strategy.
@@ -454,6 +455,11 @@ func (cr *VMAuth) Validate() error {
if cr.Spec.ServiceSpec != nil && cr.Spec.ServiceSpec.Name == cr.PrefixedName() {
return fmt.Errorf("spec.serviceSpec.Name cannot be equal to prefixed name=%q", cr.PrefixedName())
}
+ if len(cr.Spec.InternalListenPort) > 0 {
+ if l := cr.Spec.ByName("internal"); l != nil {
+ return fmt.Errorf("httpListeners name %q collides with the name generated for spec.internalListenPort", l.Name)
+ }
+ }
if cr.Spec.Ingress != nil {
// check ingress
// TlsHosts and TlsSecretName are both needed if one of them is used
@@ -643,17 +649,6 @@ func (cr *VMAuth) ProbePath() string {
return BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-func (cr *VMAuth) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-func (cr *VMAuth) ProbePort() string {
- if len(cr.Spec.InternalListenPort) > 0 {
- return cr.Spec.InternalListenPort
- }
- return cr.Spec.Port
-}
-
func (*VMAuth) ProbeNeedLiveness() bool {
return true
}
@@ -748,7 +743,33 @@ func (cr *VMAuth) GetMetricsPath() string {
// UseTLS returns true if TLS is enabled
func (cr *VMAuth) UseTLS() bool {
- return UseTLS(cr.Spec.ExtraArgs)
+ if len(cr.Spec.InternalListenPort) > 0 {
+ return UseTLS(cr.Spec.ExtraArgs)
+ }
+ return cr.Spec.UseTLS()
+}
+
+// PrimaryPortName returns the Service port name generated for the primary listener.
+func (cr *VMAuth) PrimaryPortName() string {
+ return cr.Spec.PrimaryPortName()
+}
+
+// GetListener implements AppsParams interface
+func (cr *VMAuth) GetListener(name string) *HTTPListener {
+ return cr.Spec.GetListener(name)
+}
+
+// Params implements build.scrapeBuilder and urlBuilder interfaces. For ScrapeParamsKind, it
+// prefers InternalListenPort like ProbePort does; for ServiceParamsKind (externally-facing
+// URLs), the internal-only listener must never be selected, so the real spec is used as-is.
+func (cr *VMAuth) Params(pk ParamsKind) *StandardAppsParams {
+ if pk == ScrapeParamsKind && len(cr.Spec.InternalListenPort) > 0 {
+ return &StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{ExtraArgs: cr.Spec.ExtraArgs},
+ HTTPListeners: []HTTPListener{{Name: "internal", Addr: ":" + cr.Spec.InternalListenPort}},
+ }
+ }
+ return &cr.Spec.StandardAppsParams
}
// GetExtraArgs returns additionally configured command-line arguments
@@ -785,16 +806,16 @@ func (cr *VMAuth) IsUnmanaged() bool {
// GetReloadURL implements reloadable interface
func (cr *VMAuth) GetReloadURL(host string) string {
- return BuildLocalURL(reloadAuthKeyFlag, host, cr.metricsPort(), reloadPath, cr.Spec.ExtraArgs)
-}
-
-// metricsPort returns the port vmauth serves /metrics (and other internal
-// routes) on: the internal port if configured, else the main port.
-func (cr *VMAuth) metricsPort() string {
if len(cr.Spec.InternalListenPort) > 0 {
- return cr.Spec.InternalListenPort
+ sp := &StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{
+ Port: cr.Spec.InternalListenPort,
+ ExtraArgs: cr.Spec.ExtraArgs,
+ },
+ }
+ return sp.BuildLocalURL(reloadAuthKeyFlag, host, reloadPath)
}
- return cr.Spec.Port
+ return cr.Spec.BuildLocalURL(reloadAuthKeyFlag, host, reloadPath)
}
// GetReloaderParams implements reloadable interface
@@ -814,7 +835,7 @@ func (cr *VMAuth) UseProxyProtocol() bool {
if cr.Spec.UseProxyProtocol {
return hasInternalPorts
}
- if UseProxyProtocol(cr.Spec.ExtraArgs) {
+ if cr.Spec.StandardAppsParams.UseProxyProtocol() {
return hasInternalPorts
}
return false
diff --git a/api/operator/v1beta1/vmcluster_types.go b/api/operator/v1beta1/vmcluster_types.go
index a9758d4388..e030697907 100644
--- a/api/operator/v1beta1/vmcluster_types.go
+++ b/api/operator/v1beta1/vmcluster_types.go
@@ -412,9 +412,13 @@ type VMSelect struct {
// to the cluster in a read-only mode.
// +optional
// +notes={available_from: "v0.74.0"}
- ExtraStorageNodes []VMStorageNode `json:"extraStorageNodes,omitempty"`
+ ExtraStorageNodes []VMStorageNode `json:"extraStorageNodes,omitempty"`
+ StandardAppsParams `json:",inline"`
+}
- CommonAppsParams `json:",inline"`
+// Params implements build.scrapeBuilder interface
+func (p *VMSelect) Params(ParamsKind) *StandardAppsParams {
+ return &p.StandardAppsParams
}
// VMStorageNode defines an additional, non-operator-managed vmstorage node
@@ -439,6 +443,36 @@ type InsertPorts struct {
OpenTSDBPort string `json:"openTSDBPort,omitempty"`
}
+// ValidateNoListenerNameCollision rejects HTTPListener names that collide with the
+// container port names generated for this InsertPorts' configured protocols.
+func (ip *InsertPorts) ValidateNoListenerNameCollision(listeners []HTTPListener) error {
+ if ip == nil {
+ return nil
+ }
+ reserved := make(map[string]struct{}, 7)
+ if ip.GraphitePort != "" {
+ reserved["graphite-tcp"] = struct{}{}
+ reserved["graphite-udp"] = struct{}{}
+ }
+ if ip.InfluxPort != "" {
+ reserved["influx-tcp"] = struct{}{}
+ reserved["influx-udp"] = struct{}{}
+ }
+ if ip.OpenTSDBPort != "" {
+ reserved["opentsdb-tcp"] = struct{}{}
+ reserved["opentsdb-udp"] = struct{}{}
+ }
+ if ip.OpenTSDBHTTPPort != "" {
+ reserved["opentsdb-http"] = struct{}{}
+ }
+ for i := range listeners {
+ if _, ok := reserved[listeners[i].Name]; ok {
+ return fmt.Errorf("httpListeners[%d].name=%q collides with a name generated for spec.insertPorts", i, listeners[i].Name)
+ }
+ }
+ return nil
+}
+
type VMInsert struct {
// ComponentVersion defines default images tag for this component.
// it can be overwritten with component specific image.tag value.
@@ -497,7 +531,12 @@ type VMInsert struct {
// +optional
Discovery *VMClusterDiscovery `json:"discovery,omitempty"`
- CommonAppsParams `json:",inline"`
+ StandardAppsParams `json:",inline"`
+}
+
+// Params implements build.scrapeBuilder interface
+func (p *VMInsert) Params(ParamsKind) *StandardAppsParams {
+ return &p.StandardAppsParams
}
func (cr *VMInsert) ProbePath() string {
@@ -506,15 +545,7 @@ func (cr *VMInsert) ProbePath() string {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VMInsert) UseProxyProtocol() bool {
- return UseProxyProtocol(cr.ExtraArgs)
-}
-
-func (cr *VMInsert) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
-func (cr *VMInsert) ProbePort() string {
- return cr.Port
+ return cr.StandardAppsParams.UseProxyProtocol()
}
func (*VMInsert) ProbeNeedLiveness() bool {
@@ -608,7 +639,12 @@ type VMStorage struct {
// ClaimTemplates allows adding additional VolumeClaimTemplates for StatefulSet
ClaimTemplates []corev1.PersistentVolumeClaim `json:"claimTemplates,omitempty"`
- CommonAppsParams `json:",inline"`
+ StandardAppsParams `json:",inline"`
+}
+
+// Params implements build.scrapeBuilder interface
+func (p *VMStorage) Params(ParamsKind) *StandardAppsParams {
+ return &p.StandardAppsParams
}
type VMBackup struct {
@@ -694,6 +730,24 @@ type VMBackup struct {
Restore *VMRestore `json:"restore,omitempty"`
}
+// GetServiceScrape implements build.ScrapeBuilder interface
+func (cr *VMBackup) GetServiceScrape() *VMServiceScrapeSpec {
+ return nil
+}
+
+// GetMetricsPath implements build.ScrapeBuilder interface
+func (cr *VMBackup) GetMetricsPath() string {
+ return metricsPath
+}
+
+// Params implements build.ScrapeBuilder interface
+func (cr *VMBackup) Params(ParamsKind) *StandardAppsParams {
+ return &StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{ExtraArgs: cr.ExtraArgs},
+ HTTPListeners: []HTTPListener{{Name: "vmbackupmanager", Addr: ":" + cr.Port, TLS: ptr.To(false)}},
+ }
+}
+
func (cr *VMBackup) validate(l *License) error {
if !l.IsProvided() && !cr.AcceptEULA {
return fmt.Errorf("it is required to provide license key. See [here](https://docs.victoriametrics.com/victoriametrics/enterprise/)")
@@ -739,7 +793,7 @@ func (cr *VMSelect) GetCacheMountVolumeName() string {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VMSelect) UseProxyProtocol() bool {
- return UseProxyProtocol(cr.ExtraArgs)
+ return cr.StandardAppsParams.UseProxyProtocol()
}
// GetRemoteWriteURL returns remote write url for VMCluster
@@ -747,7 +801,7 @@ func (cr *VMCluster) GetRemoteWriteURL() string {
if cr == nil || cr.Spec.VMInsert == nil {
return ""
}
- insertURL := cr.AsURL(ClusterComponentInsert, false)
+ insertURL, _ := cr.AsURL(ClusterComponentInsert, NamespacedName{})
return fmt.Sprintf("%s%s", insertURL, BuildPathWithPrefixFlag(cr.Spec.VMInsert.ExtraArgs, "/insert/multitenant/prometheus/api/v1/write"))
}
@@ -764,6 +818,11 @@ func (cr *VMCluster) Validate() error {
if err := vms.ServiceSpec.ValidateNoServiceTypeOverrideWithUseAsDefault(); err != nil {
return err
}
+ if vms.ClusterNativePort != "" {
+ if l := vms.ByName("clusternative"); l != nil {
+ return fmt.Errorf("vmselect: httpListeners name %q collides with the name generated for spec.clusterNativePort", l.Name)
+ }
+ }
if vms.HPA != nil {
if err := vms.HPA.Validate(); err != nil {
return err
@@ -814,6 +873,14 @@ func (cr *VMCluster) Validate() error {
if vmi.ServiceSpec != nil && vmi.ServiceSpec.Name == name {
return fmt.Errorf(".serviceSpec.Name cannot be equal to prefixed name=%q", name)
}
+ if err := vmi.InsertPorts.ValidateNoListenerNameCollision(vmi.HTTPListeners); err != nil {
+ return err
+ }
+ if vmi.ClusterNativePort != "" {
+ if l := vmi.ByName("clusternative"); l != nil {
+ return fmt.Errorf("vminsert: httpListeners name %q collides with the name generated for spec.clusterNativePort", l.Name)
+ }
+ }
if vmi.HPA != nil {
if err := vmi.HPA.Validate(); err != nil {
return err
@@ -840,10 +907,19 @@ func (cr *VMCluster) Validate() error {
if err := vms.ServiceSpec.ValidateNoServiceTypeOverrideWithUseAsDefault(); err != nil {
return err
}
+ if l := vms.ByName("vminsert"); l != nil {
+ return fmt.Errorf("vmstorage: httpListeners name %q collides with the generated vminsert port name", l.Name)
+ }
+ if l := vms.ByName("vmselect"); l != nil {
+ return fmt.Errorf("vmstorage: httpListeners name %q collides with the generated vmselect port name", l.Name)
+ }
if cr.Spec.VMStorage.VMBackup != nil {
if err := cr.Spec.VMStorage.VMBackup.validate(cr.Spec.License); err != nil {
return err
}
+ if l := vms.ByName("vmbackupmanager"); l != nil {
+ return fmt.Errorf("vmstorage: httpListeners name %q collides with the generated vmbackupmanager port name", l.Name)
+ }
}
if err := vms.RetentionFilters.validate(cr.Spec.License, cr.Spec.RetentionPeriod); err != nil {
return err
@@ -912,32 +988,11 @@ func (cr *VMCluster) Validate() error {
// AvailableStorageNodeIDs returns ids of the storage nodes for the provided component
func (cr *VMCluster) AvailableStorageNodeIDs(kind ClusterComponent) []int32 {
- var result []int32
- if cr.Spec.VMStorage == nil || (cr.Spec.VMStorage.ReplicaCount == nil && cr.Spec.VMStorage.HPA == nil) {
- return result
- }
- maintenanceNodes := sets.New[int32]()
- switch kind {
- case ClusterComponentSelect:
- maintenanceNodes.Insert(cr.Spec.VMStorage.MaintenanceSelectNodeIDs...)
- case ClusterComponentInsert:
- maintenanceNodes.Insert(cr.Spec.VMStorage.MaintenanceInsertNodeIDs...)
- default:
- panic("BUG unsupported kind: " + string(kind))
- }
- var replicaCount int32
- if cr.Spec.VMStorage.ReplicaCount != nil {
- replicaCount = *cr.Spec.VMStorage.ReplicaCount
- } else if cr.Spec.VMStorage.HPA != nil {
- replicaCount = cr.Spec.VMStorage.HPA.GetMinReplicas()
- }
- for i := int32(0); i < replicaCount; i++ {
- if maintenanceNodes.Has(i) {
- continue
- }
- result = append(result, i)
+ if cr.Spec.VMStorage == nil {
+ return nil
}
- return result
+ return AvailableStorageNodeIDs(kind, cr.Spec.VMStorage.ReplicaCount, cr.Spec.VMStorage.HPA,
+ cr.Spec.VMStorage.MaintenanceSelectNodeIDs, cr.Spec.VMStorage.MaintenanceInsertNodeIDs)
}
// FinalLabels adds cluster labels to the base labels and filters by prefix if needed
@@ -977,11 +1032,6 @@ func (cr *VMSelect) GetMetricsPath() string {
return BuildPathWithPrefixFlag(cr.ExtraArgs, metricsPath)
}
-// UseTLS returns true if TLS is enabled
-func (cr *VMSelect) UseTLS() bool {
- return UseTLS(cr.ExtraArgs)
-}
-
// ExtraArgs returns additionally configured command-line arguments
func (cr *VMSelect) GetExtraArgs() map[string]string {
return cr.ExtraArgs
@@ -1005,11 +1055,6 @@ func (cr *VMInsert) GetExtraArgs() map[string]string {
return cr.ExtraArgs
}
-// UseTLS returns true if TLS is enabled
-func (cr *VMInsert) UseTLS() bool {
- return UseTLS(cr.ExtraArgs)
-}
-
// ServiceScrape returns overrides for serviceScrape builder
func (cr *VMInsert) GetServiceScrape() *VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
@@ -1025,7 +1070,7 @@ func (cr *VMStorage) GetMetricsPath() string {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VMStorage) UseProxyProtocol() bool {
- return UseProxyProtocol(cr.ExtraArgs)
+ return cr.StandardAppsParams.UseProxyProtocol()
}
// ExtraArgs returns additionally configured command-line arguments
@@ -1033,26 +1078,11 @@ func (cr *VMStorage) GetExtraArgs() map[string]string {
return cr.ExtraArgs
}
-// UseTLS returns true if TLS is enabled
-func (cr *VMStorage) UseTLS() bool {
- return UseTLS(cr.ExtraArgs)
-}
-
// ServiceScrape returns overrides for serviceScrape builder
func (cr *VMStorage) GetServiceScrape() *VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
}
-// SnapshotCreatePathWithFlags returns url for accessing vmbackupmanager component
-func (*VMBackup) SnapshotCreatePathWithFlags(host, port string, extraArgs map[string]string) string {
- return BuildLocalURL(snapshotAuthKeyFlag, host, port, snapshotCreate, extraArgs)
-}
-
-// SnapshotDeletePathWithFlags returns url for accessing vmbackupmanager component
-func (*VMBackup) SnapshotDeletePathWithFlags(host, port string, extraArgs map[string]string) string {
- return BuildLocalURL(snapshotAuthKeyFlag, host, port, snapshotDelete, extraArgs)
-}
-
// GetServiceAccountName returns service account name for all vmcluster components
func (cr *VMCluster) GetServiceAccountName() string {
if cr.Spec.ServiceAccountName == "" {
@@ -1066,59 +1096,69 @@ func (cr *VMCluster) IsOwnsServiceAccount() bool {
return cr.Spec.ServiceAccountName == ""
}
-// AsURL implements stub for interface.
-func (cr *VMCluster) AsURL(kind ClusterComponent, isExtra bool) string {
- var defaultPort string
- var svcSpec *AdditionalServiceSpec
- var extraArgs map[string]string
+// SnapshotCreatePath returns url for accessing vmbackupmanager's snapshot create endpoint
+func (cr *VMCluster) SnapshotCreatePath(host string) string {
+ if cr.Spec.VMStorage == nil {
+ return ""
+ }
+ return cr.Spec.VMStorage.BuildLocalURL(snapshotAuthKeyFlag, host, snapshotCreate)
+}
+
+// SnapshotDeletePath returns url for accessing vmbackupmanager's snapshot delete endpoint
+func (cr *VMCluster) SnapshotDeletePath(host string) string {
+ if cr.Spec.VMStorage == nil {
+ return ""
+ }
+ return cr.Spec.VMStorage.BuildLocalURL(snapshotAuthKeyFlag, host, snapshotDelete)
+}
+
+// Backup implements build.backupCRD interface
+func (cr *VMCluster) Backup() *VMBackup {
+ if cr.Spec.VMStorage == nil {
+ return nil
+ }
+ return cr.Spec.VMStorage.VMBackup
+}
+
+// Params implements ParentOpts interface: the StandardAppsParams for kind, or nil when that
+// component isn't configured.
+func (cr *VMCluster) Params(kind ClusterComponent, pk ParamsKind) *StandardAppsParams {
switch kind {
case ClusterComponentSelect:
if cr.Spec.VMSelect == nil {
- return ""
- }
- defaultPort = "8481"
- if cr.Spec.VMSelect.Port != "" {
- defaultPort = cr.Spec.VMSelect.Port
+ return nil
}
- svcSpec = cr.Spec.VMSelect.ServiceSpec
- extraArgs = cr.Spec.VMSelect.ExtraArgs
+ return cr.Spec.VMSelect.Params(pk)
case ClusterComponentInsert:
if cr.Spec.VMInsert == nil {
- return ""
- }
- defaultPort = "8480"
- if cr.Spec.VMInsert.Port != "" {
- defaultPort = cr.Spec.VMInsert.Port
+ return nil
}
- svcSpec = cr.Spec.VMInsert.ServiceSpec
- extraArgs = cr.Spec.VMInsert.ExtraArgs
+ return cr.Spec.VMInsert.Params(pk)
case ClusterComponentStorage:
if cr.Spec.VMStorage == nil {
- return ""
- }
- defaultPort = "8482"
- if cr.Spec.VMStorage.Port != "" {
- defaultPort = cr.Spec.VMStorage.Port
+ return nil
}
- svcSpec = cr.Spec.VMStorage.ServiceSpec
- extraArgs = cr.Spec.VMStorage.ExtraArgs
+ return cr.Spec.VMStorage.Params(pk)
default:
panic("BUG unsupported cluster kind=" + string(kind))
}
- svcName, port := ResolveServiceURL(cr.PrefixedName(kind), defaultPort, "http", svcSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", HTTPProtoFromFlags(extraArgs), svcName, cr.Namespace, port)
}
-func (cr *VMSelect) ProbePath() string {
- return BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
-}
-
-func (cr *VMSelect) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.ExtraArgs))
+// AsURL returns the service URL for kind, or an empty string when that component isn't
+// configured. Returns an error when nsn.ListenerName doesn't match a configured listener.
+func (cr *VMCluster) AsURL(kind ClusterComponent, nsn NamespacedName) (string, error) {
+ params := cr.Params(kind, ServiceParamsKind)
+ if params == nil {
+ return "", nil
+ }
+ if nsn.ListenerName != "" && params.GetListener(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VMCluster=%q %s httpListeners", nsn.ListenerName, cr.Name, kind)
+ }
+ return BuildServiceURL(NewChildBuilder(cr, kind), nsn)
}
-func (cr *VMSelect) ProbePort() string {
- return cr.Port
+func (cr *VMSelect) ProbePath() string {
+ return BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}
func (*VMSelect) ProbeNeedLiveness() bool {
@@ -1129,14 +1169,6 @@ func (cr *VMStorage) ProbePath() string {
return BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}
-func (cr *VMStorage) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
-func (cr *VMStorage) ProbePort() string {
- return cr.Port
-}
-
// ProbeNeedLiveness implements build.probeCRD interface
func (*VMStorage) ProbeNeedLiveness() bool {
return false
@@ -1205,11 +1237,6 @@ type VMAuthLoadBalancerSpec struct {
CommonAppsParams `json:",inline"`
}
-// ProbePort returns port for probe requests
-func (cr *VMAuthLoadBalancerSpec) ProbePort() string {
- return cr.Port
-}
-
// ProbeNeedLiveness implements build.probeCRD interface
func (*VMAuthLoadBalancerSpec) ProbeNeedLiveness() bool {
return false
@@ -1220,14 +1247,9 @@ func (cr *VMAuthLoadBalancerSpec) ProbePath() string {
return BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}
-// ProbeScheme returns scheme for probe requests
-func (cr *VMAuthLoadBalancerSpec) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.ExtraArgs))
-}
-
// UseProxyProtocol implements build.probeCRD interface
func (cr *VMAuthLoadBalancerSpec) UseProxyProtocol() bool {
- return UseProxyProtocol(cr.ExtraArgs)
+ return getFirstValue(cr.ExtraArgs, httpUseProxyProtocolFlag) == "true"
}
// GetServiceScrape implements build.serviceScrapeBuilder interface
@@ -1235,6 +1257,14 @@ func (cr *VMAuthLoadBalancerSpec) GetServiceScrape() *VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
}
+// Params implements build.scrapeBuilder interface
+func (cr *VMAuthLoadBalancerSpec) Params(ParamsKind) *StandardAppsParams {
+ return &StandardAppsParams{
+ CommonAppsParams: cr.CommonAppsParams,
+ HTTPListeners: []HTTPListener{{Name: "http", Addr: ":" + cr.Port}},
+ }
+}
+
// GetExtraArgs implements build.serviceScrapeBuilder interface
func (cr *VMAuthLoadBalancerSpec) GetExtraArgs() map[string]string {
return cr.ExtraArgs
diff --git a/api/operator/v1beta1/vmcluster_types_test.go b/api/operator/v1beta1/vmcluster_types_test.go
index 14dfde062a..61b443e9db 100644
--- a/api/operator/v1beta1/vmcluster_types_test.go
+++ b/api/operator/v1beta1/vmcluster_types_test.go
@@ -9,85 +9,28 @@ import (
"k8s.io/utils/ptr"
)
-func TestVMBackup_SnapshotDeletePathWithFlags(t *testing.T) {
- type opts struct {
- host string
- port string
- extraArgs map[string]string
- want string
- }
- f := func(o opts) {
- t.Helper()
- cr := VMBackup{}
- got := cr.SnapshotDeletePathWithFlags(o.host, o.port, o.extraArgs)
- assert.Equal(t, o.want, got)
- }
-
- // default delete path
- f(opts{
- host: "localhost",
- port: "8428",
- want: "http://localhost:8428/snapshot/delete",
- })
-
- // delete path with prefix
- f(opts{
- host: "127.0.0.1",
- port: "8428",
- extraArgs: map[string]string{httpPathPrefixFlag: "/pref-1", "other-flag": "other-value"},
- want: "http://127.0.0.1:8428/pref-1/snapshot/delete",
- })
-
- // delete path with auth key
- f(opts{
- host: "127.0.0.1",
- port: "8428",
- extraArgs: map[string]string{httpPathPrefixFlag: "/pref-1", "other-flag": "other-value", snapshotAuthKeyFlag: "test"},
- want: "http://127.0.0.1:8428/pref-1/snapshot/delete?authKey=test",
- })
-}
-
-func TestVMBackup_SnapshotCreatePathWithFlags(t *testing.T) {
- type opts struct {
- host string
- port string
- extraArgs map[string]string
- want string
- }
- f := func(o opts) {
- t.Helper()
- cr := VMBackup{}
- got := cr.SnapshotCreatePathWithFlags(o.host, o.port, o.extraArgs)
- assert.Equal(t, o.want, got)
- }
-
- // base ok
- f(opts{
- host: "localhost",
- port: "8429",
- want: "http://localhost:8429/snapshot/create",
- })
-
- // with prefix
- f(opts{
- host: "127.0.0.1",
- port: "8429",
- extraArgs: map[string]string{
- "http.pathPrefix": "/prefix/custom",
- },
- want: "http://127.0.0.1:8429/prefix/custom/snapshot/create",
- })
-
- // with prefix and auth key
- f(opts{
- host: "localhost",
- port: "8429",
- extraArgs: map[string]string{
- "http.pathPrefix": "/prefix/custom",
- "snapshotAuthKey": "some-auth-key",
+func TestVMCluster_Backup(t *testing.T) {
+ // nil VMStorage
+ cr := VMCluster{}
+ assert.Nil(t, cr.Backup())
+ assert.Equal(t, "", cr.SnapshotCreatePath("localhost"))
+ assert.Equal(t, "", cr.SnapshotDeletePath("localhost"))
+
+ // with VMStorage and VMBackup configured
+ vmBackup := &VMBackup{}
+ cr = VMCluster{
+ Spec: VMClusterSpec{
+ VMStorage: &VMStorage{
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{Port: "8482"},
+ },
+ VMBackup: vmBackup,
+ },
},
- want: "http://localhost:8429/prefix/custom/snapshot/create?authKey=some-auth-key",
- })
+ }
+ assert.Same(t, vmBackup, cr.Backup())
+ assert.Equal(t, "http://localhost:8482/snapshot/create", cr.SnapshotCreatePath("localhost"))
+ assert.Equal(t, "http://localhost:8482/snapshot/delete", cr.SnapshotDeletePath("localhost"))
}
func TestVMCluster_AvailableStorageNodeIDs(t *testing.T) {
@@ -99,8 +42,10 @@ func TestVMCluster_AvailableStorageNodeIDs(t *testing.T) {
cr := &VMCluster{
Spec: VMClusterSpec{
VMStorage: &VMStorage{
- CommonAppsParams: CommonAppsParams{
- ReplicaCount: ptr.To(int32(5)),
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{
+ ReplicaCount: ptr.To(int32(5)),
+ },
},
MaintenanceSelectNodeIDs: []int32{1, 3},
MaintenanceInsertNodeIDs: []int32{0, 4},
@@ -118,7 +63,11 @@ func TestVMCluster_AvailableStorageNodeIDs(t *testing.T) {
f(&VMCluster{
Spec: VMClusterSpec{
VMStorage: &VMStorage{
- CommonAppsParams: CommonAppsParams{ReplicaCount: ptr.To(int32(3))},
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{
+ ReplicaCount: ptr.To(int32(3)),
+ },
+ },
},
},
}, ClusterComponentSelect, []int32{0, 1, 2})
@@ -141,7 +90,11 @@ func TestVMCluster_Validate(t *testing.T) {
// downsampling without license
f(VMClusterSpec{
Downsampling: &DownsamplingConfig{
- Rules: []DownsamplingRule{{Periods: []DownsamplingPeriod{{Offset: "30d", Interval: "10m"}}}},
+ Rules: []DownsamplingRule{{
+ Periods: []DownsamplingPeriod{
+ {Offset: "30d", Interval: "10m"},
+ },
+ }},
},
}, true)
@@ -149,7 +102,11 @@ func TestVMCluster_Validate(t *testing.T) {
f(VMClusterSpec{
License: testLicense,
Downsampling: &DownsamplingConfig{
- Rules: []DownsamplingRule{{Periods: []DownsamplingPeriod{{Offset: "30d", Interval: "10m"}}}},
+ Rules: []DownsamplingRule{{
+ Periods: []DownsamplingPeriod{
+ {Offset: "30d", Interval: "10m"},
+ },
+ }},
},
}, false)
@@ -157,7 +114,12 @@ func TestVMCluster_Validate(t *testing.T) {
f(VMClusterSpec{
License: testLicense,
Downsampling: &DownsamplingConfig{
- Rules: []DownsamplingRule{{Filter: `{env="prod"}`, Periods: []DownsamplingPeriod{{Offset: "90d", Interval: "1h"}}}},
+ Rules: []DownsamplingRule{{
+ Filter: `{env="prod"}`,
+ Periods: []DownsamplingPeriod{
+ {Offset: "90d", Interval: "1h"},
+ },
+ }},
DedupInterval: "1m",
},
}, false)
@@ -166,10 +128,12 @@ func TestVMCluster_Validate(t *testing.T) {
f(VMClusterSpec{
License: testLicense,
Downsampling: &DownsamplingConfig{
- Rules: []DownsamplingRule{{Periods: []DownsamplingPeriod{
- {Offset: "30d", Interval: "10m"},
- {Offset: "180d", Interval: "1h"},
- }}},
+ Rules: []DownsamplingRule{{
+ Periods: []DownsamplingPeriod{
+ {Offset: "30d", Interval: "10m"},
+ {Offset: "180d", Interval: "1h"},
+ },
+ }},
},
}, false)
@@ -188,7 +152,9 @@ func TestVMCluster_Validate(t *testing.T) {
f(VMClusterSpec{
License: testLicense,
Downsampling: &DownsamplingConfig{
- Rules: []DownsamplingRule{{Periods: []DownsamplingPeriod{{Offset: "1d", Interval: "7m"}}}},
+ Rules: []DownsamplingRule{
+ {Periods: []DownsamplingPeriod{{Offset: "1d", Interval: "7m"}}},
+ },
},
}, true)
@@ -196,7 +162,9 @@ func TestVMCluster_Validate(t *testing.T) {
f(VMClusterSpec{
License: testLicense,
Downsampling: &DownsamplingConfig{
- Rules: []DownsamplingRule{{Periods: []DownsamplingPeriod{{Offset: "30d", Interval: "10m"}}}},
+ Rules: []DownsamplingRule{
+ {Periods: []DownsamplingPeriod{{Offset: "30d", Interval: "10m"}}},
+ },
DedupInterval: "7m",
},
}, true)
@@ -205,7 +173,9 @@ func TestVMCluster_Validate(t *testing.T) {
f(VMClusterSpec{
License: testLicense,
Downsampling: &DownsamplingConfig{
- Rules: []DownsamplingRule{{Periods: []DownsamplingPeriod{{Offset: "30d", Interval: "10m"}}}},
+ Rules: []DownsamplingRule{
+ {Periods: []DownsamplingPeriod{{Offset: "30d", Interval: "10m"}}},
+ },
DedupInterval: "5m",
},
}, false)
@@ -359,8 +329,10 @@ func TestVMCluster_Validate(t *testing.T) {
// extraStorageNodes duplicating extraArgs storageNode
f(VMClusterSpec{
VMSelect: &VMSelect{
- CommonAppsParams: CommonAppsParams{
- ExtraArgs: map[string]string{"storageNode": "localhost:10101"},
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{
+ ExtraArgs: map[string]string{"storageNode": "localhost:10101"},
+ },
},
ExtraStorageNodes: []VMStorageNode{
{Addr: "localhost:10101"},
@@ -455,7 +427,7 @@ func TestVMCluster_Validate(t *testing.T) {
ServiceSpec: &AdditionalServiceSpec{
UseAsDefault: true,
Spec: corev1.ServiceSpec{
- Ports: []corev1.ServicePort{{Name: "vminsert", Port: 8480}},
+ Ports: []corev1.ServicePort{{Name: "http", Port: 8482}},
},
},
},
@@ -477,8 +449,10 @@ func TestVMCluster_Validate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test"},
Spec: VMClusterSpec{
VMStorage: &VMStorage{
- CommonAppsParams: CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
- VMSelectPort: "8481",
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
+ VMSelectPort: "8481",
},
VMSelect: &VMSelect{},
},
diff --git a/api/operator/v1beta1/vmextra_types.go b/api/operator/v1beta1/vmextra_types.go
index d9d4a2bcb3..43039eaace 100644
--- a/api/operator/v1beta1/vmextra_types.go
+++ b/api/operator/v1beta1/vmextra_types.go
@@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
+ "net"
"net/url"
"path"
"reflect"
@@ -22,7 +23,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
+ "k8s.io/apimachinery/pkg/util/sets"
+ "k8s.io/apimachinery/pkg/util/validation"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
+ "k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
)
@@ -58,6 +62,37 @@ const (
ClusterComponentStorage ClusterComponent = "storage"
)
+// AvailableStorageNodeIDs returns storage node ids not excluded via maintenance node ids,
+// for the given kind (select or insert). Shared by VMCluster/VLCluster/VTCluster.
+func AvailableStorageNodeIDs(kind ClusterComponent, replicaCount *int32, hpa *EmbeddedHPA, maintenanceSelectNodeIDs, maintenanceInsertNodeIDs []int32) []int32 {
+ var result []int32
+ if replicaCount == nil && hpa == nil {
+ return result
+ }
+ maintenanceNodes := sets.New[int32]()
+ switch kind {
+ case ClusterComponentSelect:
+ maintenanceNodes.Insert(maintenanceSelectNodeIDs...)
+ case ClusterComponentInsert:
+ maintenanceNodes.Insert(maintenanceInsertNodeIDs...)
+ default:
+ panic("BUG unsupported kind: " + string(kind))
+ }
+ var count int32
+ if replicaCount != nil {
+ count = *replicaCount
+ } else if hpa != nil {
+ count = hpa.GetMinReplicas()
+ }
+ for i := int32(0); i < count; i++ {
+ if maintenanceNodes.Has(i) {
+ continue
+ }
+ result = append(result, i)
+ }
+ return result
+}
+
type MetadataStrategy string
const (
@@ -73,8 +108,15 @@ const (
MetadataStrategyMergePromPriority MetadataStrategy = "merge-prometheus-priority"
)
+// MetricsAuthKeyFlag is the ExtraArgs key for a component's own /metrics auth key.
+const MetricsAuthKeyFlag = "metricsAuthKey"
+
+// TLSSecretVolumeNamePrefix is a reserved volume-name prefix.
+const TLSSecretVolumeNamePrefix = "secret-tls-"
+
const (
httpPathPrefixFlag = "http.pathPrefix"
+ httpListenAddrFlag = "httpListenAddr"
httpUseProxyProtocolFlag = "httpListenAddr.useProxyProtocol"
reloadAuthKeyFlag = "reloadAuthKey"
tlsFlag = "tls"
@@ -187,6 +229,76 @@ func ClusterSuffixedName(kind ClusterComponent, name, prefix string, internal bo
return fmt.Sprintf("%s-%s%s", name, prefix, string(kind))
}
+// ParentOpts is implemented by cluster CRs (VMCluster, VLCluster, VTCluster) to provide
+// per-component values for their generated child objects, addressed via ClusterComponent.
+// +kubebuilder:object:generate=false
+type ParentOpts interface {
+ client.Object
+ PrefixedInternalName(ClusterComponent) string
+ PrefixedName(ClusterComponent) string
+ SelectorLabels(ClusterComponent) map[string]string
+ GetServiceAccountName() string
+ GetAdditionalService(ClusterComponent) *AdditionalServiceSpec
+ IsOwnsServiceAccount() bool
+ FinalAnnotations() map[string]string
+ FinalLabels(ClusterComponent) map[string]string
+ AsOwner() metav1.OwnerReference
+ // Params returns the StandardAppsParams for kind, or nil when that component isn't configured.
+ Params(kind ClusterComponent, pk ParamsKind) *StandardAppsParams
+}
+
+// ChildBuilder adapts a ParentOpts CR and a ClusterComponent kind to the no-arg shape
+// needed by builders like Service, NetworkPolicy, PodDisruptionBudget, and BuildServiceURL.
+// +kubebuilder:object:generate=false
+type ChildBuilder struct {
+ ParentOpts
+ kind ClusterComponent
+ finalLabels map[string]string
+ selectorLabels map[string]string
+}
+
+// PrefixedName implements build.builderOpts interface
+func (b *ChildBuilder) PrefixedName() string {
+ return b.ParentOpts.PrefixedName(b.kind)
+}
+
+// FinalLabels implements build.builderOpts interface
+func (b *ChildBuilder) FinalLabels() map[string]string {
+ return b.finalLabels
+}
+
+// SelectorLabels implements build.builderOpts interface
+func (b *ChildBuilder) SelectorLabels() map[string]string {
+ return b.selectorLabels
+}
+
+// GetAdditionalService implements build.builderOpts interface
+func (b *ChildBuilder) GetAdditionalService() *AdditionalServiceSpec {
+ return b.ParentOpts.GetAdditionalService(b.kind)
+}
+
+func (b *ChildBuilder) SetFinalLabels(ls map[string]string) {
+ b.finalLabels = ls
+}
+
+func (b *ChildBuilder) SetSelectorLabels(ls map[string]string) {
+ b.selectorLabels = ls
+}
+
+// Params implements urlBuilder interface
+func (b *ChildBuilder) Params(pk ParamsKind) *StandardAppsParams {
+ return b.ParentOpts.Params(b.kind, pk)
+}
+
+func NewChildBuilder(cr ParentOpts, kind ClusterComponent) *ChildBuilder {
+ return &ChildBuilder{
+ ParentOpts: cr,
+ kind: kind,
+ finalLabels: cr.FinalLabels(kind),
+ selectorLabels: cr.SelectorLabels(kind),
+ }
+}
+
func getFirstValue(args map[string]string, name string) string {
if v, ok := args[name]; ok {
if idx := strings.Index(v, ","); idx != -1 {
@@ -197,11 +309,6 @@ func getFirstValue(args map[string]string, name string) string {
return ""
}
-// UseProxyProtocol is a helper for build.probeCRD interface implementations
-func UseProxyProtocol(extraArgs map[string]string) bool {
- return getFirstValue(extraArgs, httpUseProxyProtocolFlag) == "true"
-}
-
// EmbeddedObjectMetadata contains a subset of the fields included in k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta
// Only fields which are relevant to embedded resources are included.
type EmbeddedObjectMetadata struct {
@@ -424,34 +531,91 @@ func (ss *AdditionalServiceSpec) NameOrDefault(defaultName string) string {
return defaultName + "-additional-service"
}
-// ResolveServiceURL returns the service name and port for building a CR's URL.
-// When isExtra is true it targets the additional service (spec.serviceSpec).
-// portName is the named port to look up in the service spec (typically "http").
-func ResolveServiceURL(prefixedName, defaultPort, portName string, svcSpec *AdditionalServiceSpec, isExtra bool) (svcName, port string) {
- port = defaultPort
- svcName = prefixedName
- if isExtra {
+// urlBuilder supplies everything BuildServiceURL needs to build a CR's service URL.
+type urlBuilder interface {
+ Params(ParamsKind) *StandardAppsParams
+ PrefixedName() string
+ GetNamespace() string
+ GetAdditionalService() *AdditionalServiceSpec
+}
+
+// BuildServiceURL resolves the service name and port for b.PrefixedName() - targeting the
+// additional service (spec.serviceSpec) when nsn.UseExtraService is true - and builds a
+// "scheme://svcName.namespace.svc:port" URL for it. Returns an error when the extra service
+// defines explicit ports but none match the resolved port name.
+func BuildServiceURL(b urlBuilder, nsn NamespacedName) (string, error) {
+ params := b.Params(ServiceParamsKind)
+ svcSpec := b.GetAdditionalService()
+ prefixedName := b.PrefixedName()
+
+ l := params.GetListener(nsn.ListenerName)
+ if nsn.ListenerName != "" && l == nil {
+ return "", fmt.Errorf("listenerName=%q not found in httpListeners", nsn.ListenerName)
+ }
+
+ portName := nsn.ListenerName
+ if portName == "" {
+ if l != nil {
+ portName = l.Name
+ } else {
+ portName = params.DefaultPortName()
+ }
+ }
+ port := params.DefaultPort()
+ if l != nil {
+ if rawPort := l.AddrPort(); rawPort != "" {
+ port = rawPort
+ }
+ }
+ tls := UseTLS(params.ExtraArgs)
+ if l != nil && l.TLS != nil {
+ tls = *l.TLS
+ }
+ scheme := "http"
+ if tls {
+ scheme = "https"
+ }
+
+ svcName := prefixedName
+ if nsn.UseExtraService {
svcName = svcSpec.NameOrDefault(prefixedName)
}
- if svcSpec != nil && (isExtra || svcSpec.UseAsDefault) {
+ trustResolvedPort := nsn.UseExtraService || (svcSpec != nil && svcSpec.UseAsDefault)
+ if trustResolvedPort && svcSpec != nil {
+ var found bool
for _, svcPort := range svcSpec.Spec.Ports {
if svcPort.Name == portName {
port = fmt.Sprintf("%d", svcPort.Port)
+ found = true
break
}
}
+ if !found && len(svcSpec.Spec.Ports) == 1 {
+ port = fmt.Sprintf("%d", svcSpec.Spec.Ports[0].Port)
+ found = true
+ }
+ if !found && nsn.UseExtraService && len(svcSpec.Spec.Ports) > 0 {
+ return "", fmt.Errorf("service %q does not expose a port named %q", svcName, portName)
+ }
}
- return svcName, port
+ return fmt.Sprintf("%s://%s.%s.svc:%s", scheme, svcName, b.GetNamespace(), port), nil
}
-// BuildLocalURL builds API path for given args
-func BuildLocalURL(key, host, port, path string, extraArgs map[string]string) string {
+// BuildLocalURL builds a local API URL using the params' scheme, port, and ExtraArgs.
+// The primary listener's port overrides Port when HTTPListeners are configured.
+func (p *StandardAppsParams) BuildLocalURL(key, host, path string) string {
+ port := p.Port
+ if l := p.Primary(); l != nil {
+ if lport := l.AddrPort(); lport != "" {
+ port = lport
+ }
+ }
localURL := &url.URL{
- Scheme: HTTPProtoFromFlags(extraArgs),
+ Scheme: p.Proto(),
Host: fmt.Sprintf("%s:%s", host, port),
- Path: BuildPathWithPrefixFlag(extraArgs, path),
+ Path: BuildPathWithPrefixFlag(p.ExtraArgs, path),
}
- if authKey, ok := extraArgs[key]; ok {
+ if authKey, ok := p.ExtraArgs[key]; ok {
q := url.Values{}
q.Add("authKey", authKey)
localURL.RawQuery = q.Encode()
@@ -464,6 +628,32 @@ func UseTLS(extraArgs map[string]string) bool {
return getFirstValue(extraArgs, tlsFlag) == "true"
}
+// UseProxyProtocol returns true if PROXY protocol is enabled
+func UseProxyProtocol(extraArgs map[string]string) bool {
+ return getFirstValue(extraArgs, httpUseProxyProtocolFlag) == "true"
+}
+
+// FirstHTTPListenAddrOverride returns the first comma-separated -httpListenAddr value
+// from extraArgs, and whether the flag was set at all.
+func FirstHTTPListenAddrOverride(extraArgs map[string]string) (string, bool) {
+ addr, ok := extraArgs[httpListenAddrFlag]
+ if !ok {
+ return "", false
+ }
+ if idx := strings.Index(addr, ","); idx != -1 {
+ addr = addr[:idx]
+ }
+ return strings.TrimSpace(addr), true
+}
+
+// Scheme returns "https" if TLS is enabled per extraArgs, "http" otherwise.
+func Scheme(extraArgs map[string]string) string {
+ if UseTLS(extraArgs) {
+ return "https"
+ }
+ return "http"
+}
+
// BuildPathWithPrefixFlag returns provided path with possible prefix from flags
func BuildPathWithPrefixFlag(flags map[string]string, defaultPath string) string {
if prefix, ok := flags[httpPathPrefixFlag]; ok {
@@ -472,14 +662,105 @@ func BuildPathWithPrefixFlag(flags map[string]string, defaultPath string) string
return defaultPath
}
-// HTTPProtoFromFlags returns HTTP protocol prefix from provided flags
-func HTTPProtoFromFlags(flags map[string]string) string {
- if UseTLS(flags) {
+// AddrPort returns the port portion of the listener Addr (e.g. "8428" for ":8428").
+func (l *HTTPListener) AddrPort() string {
+ _, port, _ := net.SplitHostPort(l.Addr)
+ return port
+}
+
+// Proto returns "https" if TLS is explicitly enabled on this listener, "http" otherwise.
+// Unlike StandardAppsParams.Proto it does not fall back to ExtraArgs.
+func (l *HTTPListener) Proto() string {
+ if l.TLS != nil && *l.TLS {
return "https"
}
return "http"
}
+// Validate checks the HTTPListener for well-formed configuration.
+func (l *HTTPListener) Validate() error {
+ _, portStr, err := net.SplitHostPort(l.Addr)
+ if err != nil {
+ return fmt.Errorf("addr=%q must be a valid host:port address: %w", l.Addr, err)
+ }
+ if port, err := strconv.Atoi(portStr); err != nil || port < 1 || port > 65535 {
+ return fmt.Errorf("addr=%q: port must be a number between 1 and 65535", l.Addr)
+ }
+ if l.Name == "" {
+ return fmt.Errorf("name is required")
+ }
+ if errs := validation.IsValidPortName(l.Name); len(errs) > 0 {
+ return fmt.Errorf("name=%q is not a valid port name: %s", l.Name, strings.Join(errs, "; "))
+ }
+ if l.TLSCertFile != "" && l.TLSCertSecret != nil {
+ return fmt.Errorf("tlsCertFile and tlsCertSecret are mutually exclusive")
+ }
+ if l.TLSKeyFile != "" && l.TLSKeySecret != nil {
+ return fmt.Errorf("tlsKeyFile and tlsKeySecret are mutually exclusive")
+ }
+ if l.MTLSCAFile != "" && l.MTLSCASecret != nil {
+ return fmt.Errorf("mtlsCAFile and mtlsCASecret are mutually exclusive")
+ }
+ return nil
+}
+
+// Validate checks StandardAppsParams for semantic errors, including HTTPListeners.
+func (p *StandardAppsParams) Validate() error {
+ if err := p.CommonAppsParams.Validate(); err != nil {
+ return err
+ }
+ if addr, ok := p.ExtraArgs[httpListenAddrFlag]; ok && strings.Contains(addr, ",") {
+ return fmt.Errorf("extraArgs[%q]=%q binds multiple addresses; configure httpListeners instead so each gets its own Service port", httpListenAddrFlag, addr)
+ }
+ if len(p.HTTPListeners) > 0 {
+ if addr, ok := FirstHTTPListenAddrOverride(p.ExtraArgs); ok {
+ synthesized := len(p.HTTPListeners) == 1 && p.HTTPListeners[0].Name == "http" && p.HTTPListeners[0].Addr == addr
+ if !synthesized {
+ return fmt.Errorf("httpListeners and extraArgs[%q] are mutually exclusive", httpListenAddrFlag)
+ }
+ }
+ if _, ok := p.ExtraArgs[httpUseProxyProtocolFlag]; ok {
+ for i := range p.HTTPListeners {
+ if p.HTTPListeners[i].UseProxyProtocol != nil {
+ return fmt.Errorf("httpListeners[%d].useProxyProtocol and extraArgs[%q] are mutually exclusive", i, httpUseProxyProtocolFlag)
+ }
+ }
+ }
+ if _, ok := p.ExtraArgs[tlsFlag]; ok {
+ for i := range p.HTTPListeners {
+ if p.HTTPListeners[i].TLS != nil {
+ return fmt.Errorf("httpListeners[%d].tls and extraArgs[%q] are mutually exclusive", i, tlsFlag)
+ }
+ }
+ }
+ }
+ return p.ValidateHTTPListeners()
+}
+
+// ValidateHTTPListeners validates each configured HTTPListener, rejects duplicate names,
+// and rejects more than one listener marked Primary.
+func (p *StandardAppsParams) ValidateHTTPListeners() error {
+ seen := make(map[string]struct{}, len(p.HTTPListeners))
+ hasPrimary := false
+ for i := range p.HTTPListeners {
+ l := &p.HTTPListeners[i]
+ if err := l.Validate(); err != nil {
+ return fmt.Errorf("httpListeners[%d]: %w", i, err)
+ }
+ if _, ok := seen[l.Name]; ok {
+ return fmt.Errorf("httpListeners[%d]: duplicate name=%q", i, l.Name)
+ }
+ seen[l.Name] = struct{}{}
+ if l.Primary {
+ if hasPrimary {
+ return fmt.Errorf("httpListeners[%d]: found more than one listener marked primary, which is not allowed", i)
+ }
+ hasPrimary = true
+ }
+ }
+ return nil
+}
+
type EmbeddedPodDisruptionBudgetSpec struct {
// An eviction is allowed if at least "minAvailable" pods selected by
// "selector" will still be available after the eviction, i.e. even in the
@@ -1180,7 +1461,8 @@ func (c *TLSConfig) appendForbiddenProperties(props []string) []string {
// UnmarshalSpecStrict decodes spec JSON into v and rejects unknown fields.
// A lenient pass runs first so real parse errors (type mismatches, syntax)
// are returned before unknown-field errors can hide them.
-func UnmarshalSpecStrict(data []byte, v any) error {
+func UnmarshalSpecStrict[T any](data []byte, v *T) error {
+ *v = *new(T)
if err := json.Unmarshal(data, v); err != nil {
return err
}
@@ -1661,9 +1943,267 @@ func (p *CommonAppsParams) Validate() error {
*p.PreStopSleepSeconds, *p.TerminationGracePeriodSeconds)
}
}
+ for _, v := range p.Volumes {
+ if strings.HasPrefix(v.Name, TLSSecretVolumeNamePrefix) {
+ return fmt.Errorf("volumes[].name=%q must not start with reserved prefix %q", v.Name, TLSSecretVolumeNamePrefix)
+ }
+ }
return nil
}
+// ParamsKind selects which of a CR's HTTPListeners a Params call should reflect: the same
+// listener can be usable for self-scraping but wrong for building externally-facing URLs
+// (e.g. an internal-only listener).
+type ParamsKind int
+
+const (
+ // ScrapeParamsKind is for self-scraping: any HTTP-only listener is scrapeable, internal or not.
+ ScrapeParamsKind ParamsKind = iota
+ // ServiceParamsKind is for externally-facing URLs (VMUser targetRef, remoteWrite, ...), where
+ // internal-only listeners must never be selected.
+ ServiceParamsKind
+)
+
+// StandardAppsParams extends CommonAppsParams for standard Go-binary applications
+// that expose one or more HTTP listeners via -httpListenAddr flags.
+type StandardAppsParams struct {
+ CommonAppsParams `json:",inline"`
+ // HTTPListeners configures HTTP listen addresses with optional per-listener
+ // TLS and proxy protocol settings. When set, takes precedence over Port for
+ // service port and argument generation.
+ // +optional
+ HTTPListeners []HTTPListener `json:"httpListeners,omitempty"`
+}
+
+// Proto returns "https" or "http" for the primary listener, falling back to ExtraArgs.
+func (p *StandardAppsParams) Proto() string {
+ if l := p.Primary(); l != nil && l.TLS != nil {
+ if *l.TLS {
+ return "https"
+ }
+ return "http"
+ }
+ if UseTLS(p.ExtraArgs) {
+ return "https"
+ }
+ return "http"
+}
+
+// UseTLS returns true if TLS is enabled
+func (p *StandardAppsParams) UseTLS() bool {
+ return p.Proto() == "https"
+}
+
+// UseProxyProtocol checks the primary listener first, then falls back to ExtraArgs.
+func (p *StandardAppsParams) UseProxyProtocol() bool {
+ if l := p.Primary(); l != nil && l.UseProxyProtocol != nil {
+ return *l.UseProxyProtocol
+ }
+ return getFirstValue(p.ExtraArgs, httpUseProxyProtocolFlag) == "true"
+}
+
+// Primary returns the listener marked Primary, the first listener, or nil when empty.
+func (p *StandardAppsParams) Primary() *HTTPListener {
+ for i := range p.HTTPListeners {
+ if p.HTTPListeners[i].Primary {
+ return &p.HTTPListeners[i]
+ }
+ }
+ if len(p.HTTPListeners) > 0 {
+ return &p.HTTPListeners[0]
+ }
+ return nil
+}
+
+// ByName returns the listener with the given name, or nil if not found.
+// Returns nil immediately when name is empty.
+func (p *StandardAppsParams) ByName(name string) *HTTPListener {
+ if name == "" {
+ return nil
+ }
+ for i := range p.HTTPListeners {
+ if p.HTTPListeners[i].Name == name {
+ return &p.HTTPListeners[i]
+ }
+ }
+ return nil
+}
+
+// DefaultPort implements urlBuilder: the components Port field.
+func (p *StandardAppsParams) DefaultPort() string { return p.Port }
+
+// DefaultPortName implements urlBuilder: a fixed "http" port name.
+func (p *StandardAppsParams) DefaultPortName() string { return "http" }
+
+// DefaultScheme implements urlBuilder, derived from ExtraArgs["tls"].
+func (p *StandardAppsParams) DefaultScheme() string { return Scheme(p.ExtraArgs) }
+
+// GetListener implements urlBuilder: the named listener, the primary listener when name
+// is empty, or nil when there's no match.
+func (p *StandardAppsParams) GetListener(name string) *HTTPListener {
+ if name == "" {
+ return p.Primary()
+ }
+ return p.ByName(name)
+}
+
+// GetListeners returns every configured HTTPListener.
+func (p *StandardAppsParams) GetListeners() []HTTPListener {
+ return p.HTTPListeners
+}
+
+// GetScrapeListeners returns every configured listener that doesn't use PROXY protocol, or a
+// single default "http" listener when none are configured.
+func (p *StandardAppsParams) GetScrapeListeners() []HTTPListener {
+ useTLS := UseTLS(p.ExtraArgs)
+ if len(p.HTTPListeners) == 0 {
+ if p.UseProxyProtocol() {
+ return nil
+ }
+ return []HTTPListener{{
+ Name: "http",
+ TLS: ptr.To(useTLS),
+ }}
+ }
+ useProxyProtocol := UseProxyProtocol(p.ExtraArgs)
+ var listeners []HTTPListener
+ for _, l := range p.HTTPListeners {
+ if ptr.Deref(l.UseProxyProtocol, useProxyProtocol) {
+ continue
+ }
+ l.TLS = ptr.To(ptr.Deref(l.TLS, useTLS))
+ listeners = append(listeners, l)
+ }
+ return listeners
+}
+
+// PrimaryPort returns the primary listener's port, else legacyPort.
+func (p *StandardAppsParams) PrimaryPort(legacyPort string) string {
+ if l := p.Primary(); l != nil {
+ if port := l.AddrPort(); port != "" {
+ return port
+ }
+ }
+ return legacyPort
+}
+
+// PrimaryPortName returns the Service port name generated for the primary listener, defaulting to "http".
+func (p *StandardAppsParams) PrimaryPortName() string {
+ if l := p.Primary(); l != nil {
+ return l.Name
+ }
+ return "http"
+}
+
+// PortNameFor returns listenerName when set, otherwise the primary listener's Service port name.
+func (p *StandardAppsParams) PortNameFor(listenerName string) string {
+ if listenerName != "" {
+ return listenerName
+ }
+ return p.PrimaryPortName()
+}
+
+// ProbeListener returns the listener kubelet probes should target: the primary listener when it
+// doesn't require PROXY protocol, the first listener that doesn't, or nil when every configured
+// listener requires it. kubelet's httpGet probe connects directly to the pod and never sends the
+// PROXY protocol preamble, so a PROXY-protocol-only listener can't be probed.
+func (p *StandardAppsParams) ProbeListener() *HTTPListener {
+ useProxyProtocol := UseProxyProtocol(p.ExtraArgs)
+ if l := p.Primary(); l != nil && !ptr.Deref(l.UseProxyProtocol, useProxyProtocol) {
+ return l
+ }
+ for i := range p.HTTPListeners {
+ if !ptr.Deref(p.HTTPListeners[i].UseProxyProtocol, useProxyProtocol) {
+ return &p.HTTPListeners[i]
+ }
+ }
+ return nil
+}
+
+// ProbePort returns the port for the ProbeListener, or p.Port when no listener qualifies.
+func (p *StandardAppsParams) ProbePort() intstr.IntOrString {
+ if l := p.ProbeListener(); l != nil {
+ if port := l.AddrPort(); port != "" {
+ return intstr.Parse(port)
+ }
+ }
+ return intstr.Parse(p.Port)
+}
+
+// ProbeScheme returns the upper-cased scheme for the ProbeListener, as required by
+// corev1.URIScheme, falling back to the legacy ExtraArgs["tls"] flag.
+func (p *StandardAppsParams) ProbeScheme() string {
+ if l := p.ProbeListener(); l != nil && l.TLS != nil {
+ if *l.TLS {
+ return "HTTPS"
+ }
+ return "HTTP"
+ }
+ if UseTLS(p.ExtraArgs) {
+ return "HTTPS"
+ }
+ return "HTTP"
+}
+
+// HTTPListener defines configuration for an HTTP listen address
+// +k8s:openapi-gen=true
+type HTTPListener struct {
+ // Name is the listener name, used for Kubernetes Service port naming.
+ Name string `json:"name"`
+ // Addr is the TCP address to listen for incoming HTTP requests, e.g. :8428
+ Addr string `json:"addr"`
+ // Primary marks this listener as the probe target when multiple listeners
+ // are configured. If no listener is marked primary, the first listener is used.
+ // +optional
+ Primary bool `json:"primary,omitempty"`
+ // TLS enables TLS for the listener
+ // +optional
+ TLS *bool `json:"tls,omitempty"`
+ // TLSCertFile path to the pre-mounted server TLS certificate file.
+ // Mutually exclusive with TLSCertSecret.
+ // +optional
+ TLSCertFile string `json:"tlsCertFile,omitempty"`
+ // TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ // Mutually exclusive with TLSCertFile.
+ // +optional
+ TLSCertSecret *corev1.SecretKeySelector `json:"tlsCertSecret,omitempty"`
+ // TLSKeyFile path to the pre-mounted server TLS private key file.
+ // Mutually exclusive with TLSKeySecret.
+ // +optional
+ TLSKeyFile string `json:"tlsKeyFile,omitempty"`
+ // TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ // Mutually exclusive with TLSKeyFile.
+ // +optional
+ TLSKeySecret *corev1.SecretKeySelector `json:"tlsKeySecret,omitempty"`
+ // TLSMinVersion minimum supported TLS version
+ // +optional
+ TLSMinVersion string `json:"tlsMinVersion,omitempty"`
+ // TLSAutocertHosts enables automatic TLS certificate issuance for the listed hosts
+ // +optional
+ TLSAutocertHosts string `json:"tlsAutocertHosts,omitempty"`
+ // TLSAutocertEmail contact email for automatic TLS certificate issuance
+ // +optional
+ TLSAutocertEmail string `json:"tlsAutocertEmail,omitempty"`
+ // TLSAutocertCacheDir directory for caching automatically issued TLS certificates
+ // +optional
+ TLSAutocertCacheDir string `json:"tlsAutocertCacheDir,omitempty"`
+ // MTLS enables mutual TLS authentication
+ // +optional
+ MTLS *bool `json:"mtls,omitempty"`
+ // MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ // Mutually exclusive with MTLSCASecret.
+ // +optional
+ MTLSCAFile string `json:"mtlsCAFile,omitempty"`
+ // MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ // Mutually exclusive with MTLSCAFile.
+ // +optional
+ MTLSCASecret *corev1.SecretKeySelector `json:"mtlsCASecret,omitempty"`
+ // UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ // see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ // +optional
+ UseProxyProtocol *bool `json:"useProxyProtocol,omitempty"`
+}
+
// SecurityContext extends PodSecurityContext with ContainerSecurityContext
// It allows to globally configure security params for pod and all containers
type SecurityContext struct {
diff --git a/api/operator/v1beta1/vmextra_types_test.go b/api/operator/v1beta1/vmextra_types_test.go
index c90ee705b6..209eaad422 100644
--- a/api/operator/v1beta1/vmextra_types_test.go
+++ b/api/operator/v1beta1/vmextra_types_test.go
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
+ corev1 "k8s.io/api/core/v1"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
)
@@ -127,13 +128,22 @@ func TestStringOrArrayUnMarshal(t *testing.T) {
}
+func getStandardAppsParams(listeners []HTTPListener, args map[string]string) *StandardAppsParams {
+ return &StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{ExtraArgs: args},
+ HTTPListeners: listeners,
+ }
+}
+
func TestUseProxyProtocol(t *testing.T) {
type opts struct {
- args map[string]string
- expected bool
+ listeners []HTTPListener
+ args map[string]string
+ expected bool
}
f := func(o opts) {
- assert.Equal(t, o.expected, UseProxyProtocol(o.args))
+ t.Helper()
+ assert.Equal(t, o.expected, getStandardAppsParams(o.listeners, o.args).UseProxyProtocol())
}
// no args set
@@ -146,21 +156,21 @@ func TestUseProxyProtocol(t *testing.T) {
},
})
- // proxy protocol set to false
+ // proxy protocol set to false via ExtraArgs
f(opts{
args: map[string]string{
httpUseProxyProtocolFlag: "false",
},
})
- // first proxy protocol value is false
+ // first proxy protocol value is false via ExtraArgs
f(opts{
args: map[string]string{
httpUseProxyProtocolFlag: "false,true,true",
},
})
- // proxy protocol is true
+ // proxy protocol is true via ExtraArgs
f(opts{
args: map[string]string{
httpUseProxyProtocolFlag: "true",
@@ -168,7 +178,7 @@ func TestUseProxyProtocol(t *testing.T) {
expected: true,
})
- // only first value is true
+ // only first ExtraArgs value is true
f(opts{
args: map[string]string{
httpUseProxyProtocolFlag: "true,false,false",
@@ -176,6 +186,137 @@ func TestUseProxyProtocol(t *testing.T) {
expected: true,
})
+ // primary listener enables proxy protocol
+ f(opts{
+ listeners: []HTTPListener{
+ {Addr: ":8428", Primary: true, UseProxyProtocol: ptr.To(true)},
+ },
+ expected: true,
+ })
+
+ // primary listener disables proxy protocol, ExtraArgs says true — listener wins
+ f(opts{
+ listeners: []HTTPListener{
+ {Addr: ":8428", Primary: true, UseProxyProtocol: ptr.To(false)},
+ },
+ args: map[string]string{httpUseProxyProtocolFlag: "true"},
+ expected: false,
+ })
+
+ // listener without explicit UseProxyProtocol falls through to ExtraArgs
+ f(opts{
+ listeners: []HTTPListener{
+ {Addr: ":8428"},
+ },
+ args: map[string]string{httpUseProxyProtocolFlag: "true"},
+ expected: true,
+ })
+
+ // first listener is implicitly primary when none has Primary:true
+ f(opts{
+ listeners: []HTTPListener{
+ {Addr: ":8428", UseProxyProtocol: ptr.To(true)},
+ {Addr: ":8429", UseProxyProtocol: ptr.To(false)},
+ },
+ expected: true,
+ })
+}
+
+func TestPrimaryListener(t *testing.T) {
+ assert.Nil(t, getStandardAppsParams(nil, nil).Primary())
+ assert.Nil(t, getStandardAppsParams([]HTTPListener{}, nil).Primary())
+
+ got := getStandardAppsParams([]HTTPListener{
+ {Addr: ":8428", Name: "first"},
+ {Addr: ":8429", Name: "second", Primary: true},
+ }, nil).Primary()
+ assert.Equal(t, "second", got.Name)
+
+ // no Primary flag set — returns first
+ got2 := getStandardAppsParams([]HTTPListener{
+ {Addr: ":8428", Name: "a"},
+ {Addr: ":8429", Name: "b"},
+ }, nil).Primary()
+ assert.Equal(t, "a", got2.Name)
+}
+
+func TestHTTPProto(t *testing.T) {
+ // no listeners, no ExtraArgs
+ assert.Equal(t, "http", getStandardAppsParams(nil, nil).Proto())
+
+ // ExtraArgs TLS enabled
+ assert.Equal(t, "https", getStandardAppsParams(nil, map[string]string{tlsFlag: "true"}).Proto())
+
+ // primary listener with TLS=true overrides ExtraArgs
+ assert.Equal(t, "https", getStandardAppsParams([]HTTPListener{{Addr: ":8428", Primary: true, TLS: ptr.To(true)}}, nil).Proto())
+
+ // primary listener with TLS=false overrides ExtraArgs tls flag
+ assert.Equal(t, "http", getStandardAppsParams([]HTTPListener{{Addr: ":8428", Primary: true, TLS: ptr.To(false)}}, map[string]string{tlsFlag: "true"}).Proto())
+
+ // listener without TLS set falls through to ExtraArgs
+ assert.Equal(t, "https", getStandardAppsParams([]HTTPListener{{Addr: ":8428"}}, map[string]string{tlsFlag: "true"}).Proto())
+}
+
+func TestListenerAddrPort(t *testing.T) {
+ cases := []struct {
+ addr string
+ want string
+ }{
+ {":8428", "8428"},
+ {"0.0.0.0:9090", "9090"},
+ {"[::]:8080", "8080"},
+ }
+ for _, c := range cases {
+ l := &HTTPListener{Addr: c.addr}
+ assert.Equal(t, c.want, l.AddrPort(), "addr=%s", c.addr)
+ }
+}
+
+func TestListenerByName(t *testing.T) {
+ p := getStandardAppsParams([]HTTPListener{
+ {Name: "a", Addr: ":8428"},
+ {Name: "b", Addr: ":8429"},
+ }, nil)
+ got := p.ByName("b")
+ assert.NotNil(t, got)
+ assert.Equal(t, ":8429", got.Addr)
+
+ assert.Nil(t, p.ByName("missing"))
+ assert.Nil(t, getStandardAppsParams(nil, nil).ByName("a"))
+}
+
+func TestGetScrapeListeners(t *testing.T) {
+ // no listeners configured — falls back to a single default "http" listener
+ got0 := getStandardAppsParams(nil, nil).GetScrapeListeners()
+ assert.Equal(t, []HTTPListener{{Name: "http", TLS: ptr.To(false)}}, got0)
+
+ got0 = getStandardAppsParams(nil, map[string]string{tlsFlag: "true"}).GetScrapeListeners()
+ assert.Equal(t, []HTTPListener{{Name: "http", TLS: ptr.To(true)}}, got0)
+
+ // no listeners, legacy PROXY protocol flag set — nothing is scrapable
+ assert.Nil(t, getStandardAppsParams(nil, map[string]string{httpUseProxyProtocolFlag: "true"}).GetScrapeListeners())
+
+ // multiple plain listeners — every one is scrapeable
+ got := getStandardAppsParams([]HTTPListener{
+ {Name: "public", Addr: ":8428", Primary: true},
+ {Name: "internal", Addr: ":8429"},
+ }, nil).GetScrapeListeners()
+ assert.Len(t, got, 2)
+ assert.Equal(t, "public", got[0].Name)
+ assert.Equal(t, "internal", got[1].Name)
+
+ // a listener using PROXY protocol is excluded, the plain one remains
+ got = getStandardAppsParams([]HTTPListener{
+ {Name: "public", Addr: ":8428", Primary: true, UseProxyProtocol: ptr.To(true)},
+ {Name: "internal", Addr: ":8429"},
+ }, nil).GetScrapeListeners()
+ assert.Equal(t, []HTTPListener{{Name: "internal", Addr: ":8429", TLS: ptr.To(false)}}, got)
+
+ // every listener uses PROXY protocol — nothing is scrapable
+ got = getStandardAppsParams([]HTTPListener{
+ {Name: "public", Addr: ":8428", UseProxyProtocol: ptr.To(true)},
+ }, nil).GetScrapeListeners()
+ assert.Empty(t, got)
}
func TestEmbeddedVPAValidation(t *testing.T) {
@@ -347,6 +488,96 @@ func TestCommonAppsParamsValidate(t *testing.T) {
}, true)
}
+func TestHTTPListenerValidate(t *testing.T) {
+ f := func(l HTTPListener, wantErr bool) {
+ t.Helper()
+ err := l.Validate()
+ if wantErr {
+ assert.Error(t, err)
+ } else {
+ assert.NoError(t, err)
+ }
+ }
+ f(HTTPListener{Name: "http", Addr: ":8428"}, false)
+ f(HTTPListener{Name: "http", Addr: "bad-addr"}, true)
+ f(HTTPListener{Name: "http", Addr: ":not-a-number"}, true)
+ f(HTTPListener{Name: "http", Addr: ":0"}, true)
+ f(HTTPListener{Name: "http", Addr: ":65536"}, true)
+ f(HTTPListener{Name: "http", Addr: ":65535"}, false)
+ f(HTTPListener{Addr: ":8428"}, true)
+ f(HTTPListener{Name: "not valid!", Addr: ":8428"}, true)
+ f(HTTPListener{Name: "http", Addr: ":8428", TLSCertFile: "/tls.crt", TLSCertSecret: &corev1.SecretKeySelector{}}, true)
+ f(HTTPListener{Name: "http", Addr: ":8428", TLSKeyFile: "/tls.key", TLSKeySecret: &corev1.SecretKeySelector{}}, true)
+ f(HTTPListener{Name: "http", Addr: ":8428", MTLSCAFile: "/ca.crt", MTLSCASecret: &corev1.SecretKeySelector{}}, true)
+}
+
+func TestStandardAppsParamsValidate_HTTPListenersConflict(t *testing.T) {
+ f := func(p StandardAppsParams, wantErr bool) {
+ t.Helper()
+ err := p.Validate()
+ if wantErr {
+ assert.Error(t, err)
+ } else {
+ assert.NoError(t, err)
+ }
+ }
+ // no listeners, no conflict
+ f(StandardAppsParams{}, false)
+ // listeners without extraArgs override
+ f(StandardAppsParams{HTTPListeners: []HTTPListener{{Name: "http", Addr: ":8428"}}}, false)
+ // httpListenAddr override without listeners
+ f(StandardAppsParams{CommonAppsParams: CommonAppsParams{ExtraArgs: map[string]string{httpListenAddrFlag: ":8429"}}}, false)
+ // both set - conflict
+ f(StandardAppsParams{
+ HTTPListeners: []HTTPListener{{Name: "http", Addr: ":8428"}},
+ CommonAppsParams: CommonAppsParams{
+ ExtraArgs: map[string]string{httpListenAddrFlag: ":8429"},
+ },
+ }, true)
+ // single listener synthesized by defaulting to mirror the override - no conflict
+ f(StandardAppsParams{
+ HTTPListeners: []HTTPListener{{Name: "http", Addr: ":8429"}},
+ CommonAppsParams: CommonAppsParams{
+ ExtraArgs: map[string]string{httpListenAddrFlag: ":8429"},
+ },
+ }, false)
+ // duplicate listener names
+ f(StandardAppsParams{
+ HTTPListeners: []HTTPListener{
+ {Name: "http", Addr: ":8428"},
+ {Name: "http", Addr: ":8429"},
+ },
+ }, true)
+ // more than one listener marked primary
+ f(StandardAppsParams{
+ HTTPListeners: []HTTPListener{
+ {Name: "http", Addr: ":8428", Primary: true},
+ {Name: "mtls", Addr: ":8429", Primary: true},
+ },
+ }, true)
+ // listener's explicit TLS conflicts with extraArgs tls
+ f(StandardAppsParams{
+ HTTPListeners: []HTTPListener{{Name: "http", Addr: ":8428", TLS: ptr.To(false)}},
+ CommonAppsParams: CommonAppsParams{
+ ExtraArgs: map[string]string{tlsFlag: "true"},
+ },
+ }, true)
+ // listener's explicit UseProxyProtocol conflicts with extraArgs
+ f(StandardAppsParams{
+ HTTPListeners: []HTTPListener{{Name: "http", Addr: ":8428", UseProxyProtocol: ptr.To(false)}},
+ CommonAppsParams: CommonAppsParams{
+ ExtraArgs: map[string]string{httpUseProxyProtocolFlag: "true"},
+ },
+ }, true)
+ // extraArgs tls with no explicit per-listener TLS - no conflict (legacy fallback)
+ f(StandardAppsParams{
+ HTTPListeners: []HTTPListener{{Name: "http", Addr: ":8428"}},
+ CommonAppsParams: CommonAppsParams{
+ ExtraArgs: map[string]string{tlsFlag: "true"},
+ },
+ }, false)
+}
+
func TestVLogs_PrefixedName(t *testing.T) {
f := func(name string, omit bool, want string) {
t.Helper()
diff --git a/api/operator/v1beta1/vmsingle_types.go b/api/operator/v1beta1/vmsingle_types.go
index 15ea3d12d2..b2eca08e0c 100644
--- a/api/operator/v1beta1/vmsingle_types.go
+++ b/api/operator/v1beta1/vmsingle_types.go
@@ -3,7 +3,6 @@ package v1beta1
import (
"encoding/json"
"fmt"
- "strings"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
@@ -119,7 +118,7 @@ type VMSingleSpec struct {
CommonRelabelParams `json:",inline,omitempty"`
CommonScrapeParams `json:",inline,omitempty"`
CommonConfigReloaderParams `json:",inline,omitempty"`
- CommonAppsParams `json:",inline"`
+ StandardAppsParams `json:",inline"`
}
// HasAnyStreamAggrRule checks if vmsingle has any defined aggregation rules
@@ -176,7 +175,7 @@ func (cr *VMSingle) ExternalLabels() map[string]string {
// GetReloadURL implements reloadable interface
func (cr *VMSingle) GetReloadURL(host string) string {
- return BuildLocalURL(reloadAuthKeyFlag, host, cr.Spec.Port, reloadPath, cr.Spec.ExtraArgs)
+ return cr.Spec.BuildLocalURL(reloadAuthKeyFlag, host, reloadPath)
}
// GetReloaderParams implements reloadable interface
@@ -186,7 +185,22 @@ func (cr *VMSingle) GetReloaderParams() *CommonConfigReloaderParams {
// UseProxyProtocol implements build.probeCRD interface
func (cr *VMSingle) UseProxyProtocol() bool {
- return UseProxyProtocol(cr.Spec.ExtraArgs)
+ return cr.Spec.UseProxyProtocol()
+}
+
+// SnapshotCreatePath returns url for accessing vmbackupmanager's snapshot create endpoint
+func (cr *VMSingle) SnapshotCreatePath(host string) string {
+ return cr.Spec.BuildLocalURL(snapshotAuthKeyFlag, host, snapshotCreate)
+}
+
+// SnapshotDeletePath returns url for accessing vmbackupmanager's snapshot delete endpoint
+func (cr *VMSingle) SnapshotDeletePath(host string) string {
+ return cr.Spec.BuildLocalURL(snapshotAuthKeyFlag, host, snapshotDelete)
+}
+
+// Backup implements build.backupCRD interface
+func (cr *VMSingle) Backup() *VMBackup {
+ return cr.Spec.VMBackup
}
// AutomountServiceAccountToken implements reloadable interface
@@ -257,14 +271,6 @@ func (cr *VMSingle) ProbePath() string {
return BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
-func (cr *VMSingle) ProbeScheme() string {
- return strings.ToUpper(HTTPProtoFromFlags(cr.Spec.ExtraArgs))
-}
-
-func (cr *VMSingle) ProbePort() string {
- return cr.Spec.Port
-}
-
func (cr *VMSingle) ProbeNeedLiveness() bool {
return false
}
@@ -359,7 +365,12 @@ func (cr *VMSingle) GetExtraArgs() map[string]string {
// UseTLS returns true if TLS is enabled
func (cr *VMSingle) UseTLS() bool {
- return UseTLS(cr.Spec.ExtraArgs)
+ return cr.Spec.UseTLS()
+}
+
+// PrimaryPortName returns the Service port name generated for the primary listener.
+func (cr *VMSingle) PrimaryPortName() string {
+ return cr.Spec.PrimaryPortName()
}
// ServiceScrape returns overrides for serviceScrape builder
@@ -384,16 +395,20 @@ func (cr *VMSingle) GetRBACName() string {
}
func (cr *VMSingle) GetRemoteWriteURL() string {
- return cr.AsURL(false) + BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, "/api/v1/write")
+ url, _ := cr.AsURL(NamespacedName{})
+ return url + BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, "/api/v1/write")
}
-func (cr *VMSingle) AsURL(isExtra bool) string {
- specPort := cr.Spec.Port
- if specPort == "" {
- specPort = "8428"
+// Params implements build.scrapeBuilder and urlBuilder interfaces
+func (cr *VMSingle) Params(ParamsKind) *StandardAppsParams {
+ return &cr.Spec.StandardAppsParams
+}
+
+func (cr *VMSingle) AsURL(nsn NamespacedName) (string, error) {
+ if nsn.ListenerName != "" && cr.Spec.ByName(nsn.ListenerName) == nil {
+ return "", fmt.Errorf("listenerName=%q not found at VMSingle=%q httpListeners", nsn.ListenerName, cr.Name)
}
- svcName, port := ResolveServiceURL(cr.PrefixedName(), specPort, "http", cr.Spec.ServiceSpec, isExtra)
- return fmt.Sprintf("%s://%s.%s.svc:%s", HTTPProtoFromFlags(cr.Spec.ExtraArgs), svcName, cr.Namespace, port)
+ return BuildServiceURL(cr, nsn)
}
// LastSpecUpdated compares spec with last applied spec stored, replaces old spec and returns true if it's updated
@@ -414,10 +429,21 @@ func (cr *VMSingle) Validate() error {
if cr.Spec.ServiceSpec != nil && cr.Spec.ServiceSpec.Name == cr.PrefixedName() {
return fmt.Errorf("spec.serviceSpec.Name cannot be equal to prefixed name=%q", cr.PrefixedName())
}
+ if err := cr.Spec.InsertPorts.ValidateNoListenerNameCollision(cr.Spec.HTTPListeners); err != nil {
+ return err
+ }
if cr.Spec.VMBackup != nil {
if err := cr.Spec.VMBackup.validate(cr.Spec.License); err != nil {
return err
}
+ if l := cr.Spec.ByName("vmbackupmanager"); l != nil {
+ return fmt.Errorf("httpListeners name %q collides with the generated vmbackupmanager port name", l.Name)
+ }
+ }
+ if cr.Spec.PrimaryPort(cr.Spec.Port) != "8428" {
+ if l := cr.Spec.ByName("http-alias"); l != nil {
+ return fmt.Errorf("httpListeners name %q collides with the generated http-alias compatibility port name", l.Name)
+ }
}
if err := cr.Spec.Downsampling.validate(cr.Spec.License); err != nil {
return err
diff --git a/api/operator/v1beta1/vmsingle_types_test.go b/api/operator/v1beta1/vmsingle_types_test.go
index e9b4b7833c..4419d49a94 100644
--- a/api/operator/v1beta1/vmsingle_types_test.go
+++ b/api/operator/v1beta1/vmsingle_types_test.go
@@ -247,3 +247,106 @@ func TestVMSingle_IsUnmanaged(t *testing.T) {
Spec: VMSingleSpec{CommonScrapeParams: CommonScrapeParams{SelectAllByDefault: true}},
}, true)
}
+
+func TestVMSingle_SnapshotDeletePath(t *testing.T) {
+ type opts struct {
+ host string
+ port string
+ extraArgs map[string]string
+ httpListeners []HTTPListener
+ want string
+ }
+ f := func(o opts) {
+ t.Helper()
+ cr := VMSingle{
+ Spec: VMSingleSpec{
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{Port: o.port, ExtraArgs: o.extraArgs},
+ HTTPListeners: o.httpListeners,
+ },
+ },
+ }
+ got := cr.SnapshotDeletePath(o.host)
+ assert.Equal(t, o.want, got)
+ }
+
+ // default delete path
+ f(opts{
+ host: "localhost",
+ port: "8428",
+ want: "http://localhost:8428/snapshot/delete",
+ })
+
+ // delete path with prefix
+ f(opts{
+ host: "127.0.0.1",
+ port: "8428",
+ extraArgs: map[string]string{httpPathPrefixFlag: "/pref-1", "other-flag": "other-value"},
+ want: "http://127.0.0.1:8428/pref-1/snapshot/delete",
+ })
+
+ // delete path with auth key
+ f(opts{
+ host: "127.0.0.1",
+ port: "8428",
+ extraArgs: map[string]string{httpPathPrefixFlag: "/pref-1", "other-flag": "other-value", snapshotAuthKeyFlag: "test"},
+ want: "http://127.0.0.1:8428/pref-1/snapshot/delete?authKey=test",
+ })
+
+ // primary listener's port overrides Port
+ f(opts{
+ host: "localhost",
+ port: "8428",
+ httpListeners: []HTTPListener{{Addr: ":9999", Primary: true}},
+ want: "http://localhost:9999/snapshot/delete",
+ })
+}
+
+func TestVMSingle_SnapshotCreatePath(t *testing.T) {
+ type opts struct {
+ host string
+ port string
+ extraArgs map[string]string
+ want string
+ }
+ f := func(o opts) {
+ t.Helper()
+ cr := VMSingle{
+ Spec: VMSingleSpec{
+ StandardAppsParams: StandardAppsParams{
+ CommonAppsParams: CommonAppsParams{Port: o.port, ExtraArgs: o.extraArgs},
+ },
+ },
+ }
+ got := cr.SnapshotCreatePath(o.host)
+ assert.Equal(t, o.want, got)
+ }
+
+ // base ok
+ f(opts{
+ host: "localhost",
+ port: "8429",
+ want: "http://localhost:8429/snapshot/create",
+ })
+
+ // with prefix
+ f(opts{
+ host: "127.0.0.1",
+ port: "8429",
+ extraArgs: map[string]string{
+ "http.pathPrefix": "/prefix/custom",
+ },
+ want: "http://127.0.0.1:8429/prefix/custom/snapshot/create",
+ })
+
+ // with prefix and auth key
+ f(opts{
+ host: "localhost",
+ port: "8429",
+ extraArgs: map[string]string{
+ "http.pathPrefix": "/prefix/custom",
+ "snapshotAuthKey": "some-auth-key",
+ },
+ want: "http://localhost:8429/prefix/custom/snapshot/create?authKey=some-auth-key",
+ })
+}
diff --git a/api/operator/v1beta1/vmuser_types.go b/api/operator/v1beta1/vmuser_types.go
index 16ee822f2d..de6f9d417a 100644
--- a/api/operator/v1beta1/vmuser_types.go
+++ b/api/operator/v1beta1/vmuser_types.go
@@ -188,6 +188,16 @@ func (r *TargetRef) Validate(isDefault, isRetryCodesSet bool) error {
if len(r.CRD.Objects) == 0 && (r.CRD.Namespace == "" || r.CRD.Name == "") {
return fmt.Errorf("crd.name and crd.namespace cannot be empty")
}
+ if _, noListeners := crdKindsWithoutListeners[r.CRD.Kind]; noListeners {
+ if r.CRD.ListenerName != "" {
+ return fmt.Errorf("crd.listenerName is not supported for kind=%q", r.CRD.Kind)
+ }
+ for i, crd := range r.CRD.Objects {
+ if crd.ListenerName != "" {
+ return fmt.Errorf("crd.objects[%d].listenerName is not supported for kind=%q", i, r.CRD.Kind)
+ }
+ }
+ }
for i, crd := range r.CRD.Objects {
if crd.Namespace == "" || crd.Name == "" {
return fmt.Errorf("crd.objects[%d].name and crd.objects[%d].namespace cannot be empty", i, i)
@@ -231,6 +241,13 @@ type NamespacedName struct {
// (created via spec.serviceSpec) over the default service when building the target URL.
// +optional
UseExtraService bool `json:"useExtraService,omitempty"`
+ // ListenerName selects a specific HTTPListener by name on the target CRD.
+ // When set, the proxy URL scheme and port are taken from that listener's
+ // TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ // Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ // VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ // +optional
+ ListenerName string `json:"listenerName,omitempty"`
}
// CRDRef describe CRD target reference.
@@ -245,9 +262,18 @@ type CRDRef struct {
Objects []NamespacedName `json:"objects,omitempty"`
}
+// crdKindsWithoutListeners lists CRDRef.Kind values whose target spec has no
+// HTTPListeners support, so NamespacedName.ListenerName cannot be honored.
+var crdKindsWithoutListeners = map[string]struct{}{
+ "VMAlertmanager": {},
+ "VMAlertManager": {},
+ "VMAnomaly": {},
+ "VLogs": {},
+}
+
// AsKey returns unique key for object
func (cr *CRDRef) AsKey(nsn NamespacedName) string {
- return fmt.Sprintf("%s/%s/%s", cr.Kind, nsn.Namespace, nsn.Name)
+ return fmt.Sprintf("%s/%s/%s/%s", cr.Kind, nsn.Namespace, nsn.Name, nsn.ListenerName)
}
// StaticRef - user-defined routing host address.
diff --git a/api/operator/v1beta1/vmuser_types_test.go b/api/operator/v1beta1/vmuser_types_test.go
index d98c6392d9..3a3f8e2b76 100644
--- a/api/operator/v1beta1/vmuser_types_test.go
+++ b/api/operator/v1beta1/vmuser_types_test.go
@@ -87,6 +87,68 @@ func TestVMUser_Validate(t *testing.T) {
},
}, true)
+ // invalid ref crd, listenerName not supported for kind
+ f(&VMUser{
+ Spec: VMUserSpec{
+ Username: ptr.To("some-user"),
+ TargetRefs: []TargetRef{
+ {
+ CRD: &CRDRef{
+ Kind: "VMAlertmanager",
+ NamespacedName: NamespacedName{
+ Name: "some-1",
+ Namespace: "some-ns",
+ ListenerName: "https",
+ },
+ },
+ Paths: []string{"/some-path"},
+ },
+ },
+ },
+ }, true)
+
+ // invalid ref crd, listenerName not supported for VLogs
+ f(&VMUser{
+ Spec: VMUserSpec{
+ Username: ptr.To("some-user"),
+ TargetRefs: []TargetRef{
+ {
+ CRD: &CRDRef{
+ Kind: "VLogs",
+ NamespacedName: NamespacedName{
+ Name: "some-1",
+ Namespace: "some-ns",
+ ListenerName: "https",
+ },
+ },
+ Paths: []string{"/some-path"},
+ },
+ },
+ },
+ }, true)
+
+ // invalid ref crd, listenerName not supported for kind on a crd.objects[] entry
+ f(&VMUser{
+ Spec: VMUserSpec{
+ Username: ptr.To("some-user"),
+ TargetRefs: []TargetRef{
+ {
+ CRD: &CRDRef{
+ Kind: "VLogs",
+ Objects: []NamespacedName{
+ {
+ Name: "some-1",
+ Namespace: "some-ns",
+ ListenerName: "https",
+ },
+ },
+ },
+ Paths: []string{"/some-path"},
+ },
+ },
+ },
+ }, true)
+
// correct crd target
f(&VMUser{
Spec: VMUserSpec{
diff --git a/api/operator/v1beta1/zz_generated.deepcopy.go b/api/operator/v1beta1/zz_generated.deepcopy.go
index cbd6afb1e9..40bfc9cbf4 100644
--- a/api/operator/v1beta1/zz_generated.deepcopy.go
+++ b/api/operator/v1beta1/zz_generated.deepcopy.go
@@ -1938,6 +1938,51 @@ func (in *HTTPHeaderConfig) DeepCopy() *HTTPHeaderConfig {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *HTTPListener) DeepCopyInto(out *HTTPListener) {
+ *out = *in
+ if in.TLS != nil {
+ in, out := &in.TLS, &out.TLS
+ *out = new(bool)
+ **out = **in
+ }
+ if in.TLSCertSecret != nil {
+ in, out := &in.TLSCertSecret, &out.TLSCertSecret
+ *out = new(v1.SecretKeySelector)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.TLSKeySecret != nil {
+ in, out := &in.TLSKeySecret, &out.TLSKeySecret
+ *out = new(v1.SecretKeySelector)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.MTLS != nil {
+ in, out := &in.MTLS, &out.MTLS
+ *out = new(bool)
+ **out = **in
+ }
+ if in.MTLSCASecret != nil {
+ in, out := &in.MTLSCASecret, &out.MTLSCASecret
+ *out = new(v1.SecretKeySelector)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.UseProxyProtocol != nil {
+ in, out := &in.UseProxyProtocol, &out.UseProxyProtocol
+ *out = new(bool)
+ **out = **in
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPListener.
+func (in *HTTPListener) DeepCopy() *HTTPListener {
+ if in == nil {
+ return nil
+ }
+ out := new(HTTPListener)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HTTPSDConfig) DeepCopyInto(out *HTTPSDConfig) {
*out = *in
@@ -3832,6 +3877,29 @@ func (in *SlackField) DeepCopy() *SlackField {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *StandardAppsParams) DeepCopyInto(out *StandardAppsParams) {
+ *out = *in
+ in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ if in.HTTPListeners != nil {
+ in, out := &in.HTTPListeners, &out.HTTPListeners
+ *out = make([]HTTPListener, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StandardAppsParams.
+func (in *StandardAppsParams) DeepCopy() *StandardAppsParams {
+ if in == nil {
+ return nil
+ }
+ out := new(StandardAppsParams)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *StatefulSetUpdateStrategyBehavior) DeepCopyInto(out *StatefulSetUpdateStrategyBehavior) {
*out = *in
@@ -4989,7 +5057,7 @@ func (in *VMAgentSpec) DeepCopyInto(out *VMAgentSpec) {
in.CommonRelabelParams.DeepCopyInto(&out.CommonRelabelParams)
in.CommonScrapeParams.DeepCopyInto(&out.CommonScrapeParams)
in.CommonConfigReloaderParams.DeepCopyInto(&out.CommonConfigReloaderParams)
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMAgentSpec.
@@ -5280,7 +5348,7 @@ func (in *VMAlertSpec) DeepCopyInto(out *VMAlertSpec) {
(*in).DeepCopyInto(*out)
}
in.CommonConfigReloaderParams.DeepCopyInto(&out.CommonConfigReloaderParams)
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMAlertSpec.
@@ -5948,7 +6016,7 @@ func (in *VMAuthSpec) DeepCopyInto(out *VMAuthSpec) {
**out = **in
}
in.CommonConfigReloaderParams.DeepCopyInto(&out.CommonConfigReloaderParams)
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
if in.UpdateStrategy != nil {
in, out := &in.UpdateStrategy, &out.UpdateStrategy
*out = new(appsv1.DeploymentStrategyType)
@@ -6358,7 +6426,7 @@ func (in *VMInsert) DeepCopyInto(out *VMInsert) {
*out = new(VMClusterDiscovery)
**out = **in
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMInsert.
@@ -7266,7 +7334,7 @@ func (in *VMSelect) DeepCopyInto(out *VMSelect) {
*out = make([]VMStorageNode, len(*in))
copy(*out, *in)
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMSelect.
@@ -7518,7 +7586,7 @@ func (in *VMSingleSpec) DeepCopyInto(out *VMSingleSpec) {
in.CommonRelabelParams.DeepCopyInto(&out.CommonRelabelParams)
in.CommonScrapeParams.DeepCopyInto(&out.CommonScrapeParams)
in.CommonConfigReloaderParams.DeepCopyInto(&out.CommonConfigReloaderParams)
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMSingleSpec.
@@ -7726,7 +7794,7 @@ func (in *VMStorage) DeepCopyInto(out *VMStorage) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
- in.CommonAppsParams.DeepCopyInto(&out.CommonAppsParams)
+ in.StandardAppsParams.DeepCopyInto(&out.StandardAppsParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMStorage.
diff --git a/config/crd/overlay/crd.descriptionless.yaml b/config/crd/overlay/crd.descriptionless.yaml
index d089ae1a44..1628df7d57 100644
--- a/config/crd/overlay/crd.descriptionless.yaml
+++ b/config/crd/overlay/crd.descriptionless.yaml
@@ -332,6 +332,79 @@ spec:
type: array
hostNetwork:
type: boolean
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -1771,6 +1844,79 @@ spec:
hpa:
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -2567,6 +2713,79 @@ spec:
hpa:
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -3614,6 +3833,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -4485,6 +4777,8 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -4492,6 +4786,8 @@ spec:
objects:
items:
properties:
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -5052,6 +5348,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
httpRoute:
properties:
annotations:
@@ -5744,6 +6113,8 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -5751,6 +6122,8 @@ spec:
objects:
items:
properties:
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -6549,6 +6922,79 @@ spec:
type: array
hostNetwork:
type: boolean
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -7522,6 +7968,79 @@ spec:
type: array
hostNetwork:
type: boolean
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -8482,6 +9001,79 @@ spec:
type: array
hostNetwork:
type: boolean
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -10332,6 +10924,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
ignoreNamespaceSelectors:
type: boolean
image:
@@ -17600,6 +18265,79 @@ spec:
type: array
hostNetwork:
type: boolean
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -20763,6 +21501,8 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -20770,6 +21510,8 @@ spec:
objects:
items:
properties:
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -21330,6 +22072,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
httpRoute:
properties:
annotations:
@@ -22022,6 +22837,8 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -22029,6 +22846,8 @@ spec:
objects:
items:
properties:
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -22855,6 +23674,79 @@ spec:
hpa:
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -23594,6 +24486,79 @@ spec:
hpa:
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -24857,6 +25822,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -25980,6 +27018,8 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -25987,6 +27027,8 @@ spec:
objects:
items:
properties:
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -26547,6 +27589,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
httpRoute:
properties:
annotations:
@@ -27239,6 +28354,8 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -27246,6 +28363,8 @@ spec:
objects:
items:
properties:
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -28388,6 +29507,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -29599,6 +30791,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -40455,6 +41720,79 @@ spec:
type: array
hostNetwork:
type: boolean
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
ignoreNamespaceSelectors:
type: boolean
image:
@@ -43361,6 +44699,8 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -43368,6 +44708,8 @@ spec:
objects:
items:
properties:
+ listenerName:
+ type: string
name:
type: string
namespace:
@@ -44030,6 +45372,79 @@ spec:
type: array
hostNetwork:
type: boolean
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -45882,6 +47297,79 @@ spec:
hpa:
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -46614,6 +48102,79 @@ spec:
hpa:
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -47663,6 +49224,79 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
@@ -48547,6 +50181,79 @@ spec:
type: array
hostNetwork:
type: boolean
+ httpListeners:
+ items:
+ properties:
+ addr:
+ type: string
+ mtls:
+ type: boolean
+ mtlsCAFile:
+ type: string
+ mtlsCASecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ type: string
+ primary:
+ type: boolean
+ tls:
+ type: boolean
+ tlsAutocertCacheDir:
+ type: string
+ tlsAutocertEmail:
+ type: string
+ tlsAutocertHosts:
+ type: string
+ tlsCertFile:
+ type: string
+ tlsCertSecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ type: string
+ tlsKeySecret:
+ properties:
+ key:
+ type: string
+ name:
+ default: ""
+ type: string
+ optional:
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ type: string
+ useProxyProtocol:
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
properties:
pullPolicy:
diff --git a/config/crd/overlay/crd.yaml b/config/crd/overlay/crd.yaml
index 01463fb896..b6ff81696a 100644
--- a/config/crd/overlay/crd.yaml
+++ b/config/crd/overlay/crd.yaml
@@ -704,6 +704,152 @@ spec:
description: HostNetwork controls whether the pod may use the node
network namespace
type: boolean
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP listen
+ address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic TLS
+ certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -3561,6 +3707,152 @@ spec:
description: Configures horizontal pod autoscaling.
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -5136,6 +5428,152 @@ spec:
description: Configures horizontal pod autoscaling.
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -7165,6 +7603,152 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -8840,6 +9424,14 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -8854,6 +9446,14 @@ spec:
description: NamespacedName defines name and namespace
pairs to reference k8s object
properties:
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes
object
@@ -9897,6 +10497,152 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key
+ must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching
+ automatically issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS
+ certificate issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key
+ must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key
+ must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
httpRoute:
description: HTTPRoute enables httproute configuration for
VMAuth.
@@ -11428,6 +12174,14 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -11442,6 +12196,14 @@ spec:
description: NamespacedName defines name and
namespace pairs to reference k8s object
properties:
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes
object
@@ -13072,6 +13834,153 @@ spec:
description: HostNetwork controls whether the pod may
use the node network namespace
type: boolean
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for
+ an HTTP listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for
+ incoming HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for
+ Kubernetes Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching
+ automatically issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for
+ automatic TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic
+ TLS certificate issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS
+ version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -15207,6 +16116,153 @@ spec:
description: HostNetwork controls whether the pod may
use the node network namespace
type: boolean
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for
+ an HTTP listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen
+ for incoming HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for
+ Kubernetes Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for
+ caching automatically issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for
+ automatic TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic
+ TLS certificate issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS
+ version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -17128,6 +18184,152 @@ spec:
description: HostNetwork controls whether the pod may use the node
network namespace
type: boolean
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP listen
+ address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic TLS
+ certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -20801,6 +22003,152 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP listen
+ address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic TLS
+ certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
ignoreNamespaceSelectors:
description: |-
IgnoreNamespaceSelectors if set to true will ignore NamespaceSelector settings from
@@ -34937,6 +36285,152 @@ spec:
description: HostNetwork controls whether the pod may use the node
network namespace
type: boolean
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP listen
+ address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic TLS
+ certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -41111,6 +42605,14 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -41124,6 +42626,14 @@ spec:
description: NamespacedName defines name and namespace
pairs to reference k8s object
properties:
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -42147,6 +43657,152 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP listen
+ address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic TLS
+ certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
httpRoute:
description: HTTPRoute enables httproute configuration for VMAuth.
properties:
@@ -43667,6 +45323,14 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -43680,6 +45344,14 @@ spec:
description: NamespacedName defines name and namespace
pairs to reference k8s object
properties:
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -45221,6 +46893,152 @@ spec:
version 2.
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -46692,6 +48510,152 @@ spec:
Note, enabling this option disables vmselect to vmselect communication. In most cases it's not an issue.
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -49251,6 +51215,152 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -51420,6 +53530,14 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -51434,6 +53552,14 @@ spec:
description: NamespacedName defines name and namespace
pairs to reference k8s object
properties:
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes
object
@@ -52477,6 +54603,152 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key
+ must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching
+ automatically issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS
+ certificate issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key
+ must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key
+ must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
httpRoute:
description: HTTPRoute enables httproute configuration for
VMAuth.
@@ -54008,6 +56280,14 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -54022,6 +56302,14 @@ spec:
description: NamespacedName defines name and
namespace pairs to reference k8s object
properties:
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes
object
@@ -56289,6 +58577,153 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for
+ an HTTP listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for
+ incoming HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for
+ Kubernetes Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching
+ automatically issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for
+ automatic TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic
+ TLS certificate issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS
+ version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -58901,6 +61336,153 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for
+ an HTTP listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen
+ for incoming HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for
+ Kubernetes Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for
+ caching automatically issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for
+ automatic TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic
+ TLS certificate issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS
+ version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -78905,6 +81487,152 @@ spec:
description: HostNetwork controls whether the pod may use the node
network namespace
type: boolean
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP listen
+ address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic TLS
+ certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
ignoreNamespaceSelectors:
description: |-
IgnoreNamespaceSelectors if set to true will ignore NamespaceSelector settings from
@@ -84557,6 +87285,14 @@ spec:
- VTSingle
- VMAnomaly
type: string
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -84570,6 +87306,14 @@ spec:
description: NamespacedName defines name and namespace
pairs to reference k8s object
properties:
+ listenerName:
+ description: |-
+ ListenerName selects a specific HTTPListener by name on the target CRD.
+ When set, the proxy URL scheme and port are taken from that listener's
+ TLS and Addr fields. Falls back to the CRD's primary listener when empty.
+ Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
+ VMAnomaly, or VLogs, since those specs have no HTTPListeners.
+ type: string
name:
description: Name of the target Kubernetes object
type: string
@@ -85844,6 +88588,152 @@ spec:
description: HostNetwork controls whether the pod may use the node
network namespace
type: boolean
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP listen
+ address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic TLS
+ certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -89460,6 +92350,152 @@ spec:
description: Configures horizontal pod autoscaling.
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -90914,6 +93950,152 @@ spec:
description: Configures horizontal pod autoscaling.
type: object
x-kubernetes-preserve-unknown-fields: true
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -92949,6 +96131,152 @@ spec:
format: int32
type: integer
type: object
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP
+ listen address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic
+ TLS certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
@@ -94670,6 +97998,152 @@ spec:
description: HostNetwork controls whether the pod may use the node
network namespace
type: boolean
+ httpListeners:
+ description: |-
+ HTTPListeners configures HTTP listen addresses with optional per-listener
+ TLS and proxy protocol settings. When set, takes precedence over Port for
+ service port and argument generation.
+ items:
+ description: HTTPListener defines configuration for an HTTP listen
+ address
+ properties:
+ addr:
+ description: Addr is the TCP address to listen for incoming
+ HTTP requests, e.g. :8428
+ type: string
+ mtls:
+ description: MTLS enables mutual TLS authentication
+ type: boolean
+ mtlsCAFile:
+ description: |-
+ MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
+ Mutually exclusive with MTLSCASecret.
+ type: string
+ mtlsCASecret:
+ description: |-
+ MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
+ Mutually exclusive with MTLSCAFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ name:
+ description: Name is the listener name, used for Kubernetes
+ Service port naming.
+ type: string
+ primary:
+ description: |-
+ Primary marks this listener as the probe target when multiple listeners
+ are configured. If no listener is marked primary, the first listener is used.
+ type: boolean
+ tls:
+ description: TLS enables TLS for the listener
+ type: boolean
+ tlsAutocertCacheDir:
+ description: TLSAutocertCacheDir directory for caching automatically
+ issued TLS certificates
+ type: string
+ tlsAutocertEmail:
+ description: TLSAutocertEmail contact email for automatic TLS
+ certificate issuance
+ type: string
+ tlsAutocertHosts:
+ description: TLSAutocertHosts enables automatic TLS certificate
+ issuance for the listed hosts
+ type: string
+ tlsCertFile:
+ description: |-
+ TLSCertFile path to the pre-mounted server TLS certificate file.
+ Mutually exclusive with TLSCertSecret.
+ type: string
+ tlsCertSecret:
+ description: |-
+ TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
+ Mutually exclusive with TLSCertFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsKeyFile:
+ description: |-
+ TLSKeyFile path to the pre-mounted server TLS private key file.
+ Mutually exclusive with TLSKeySecret.
+ type: string
+ tlsKeySecret:
+ description: |-
+ TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
+ Mutually exclusive with TLSKeyFile.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ default: ""
+ description: |-
+ Name of the referent.
+ This field is effectively required, but due to backwards compatibility is
+ allowed to be empty. Instances of this type with an empty value here are
+ almost certainly wrong.
+ More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ type: string
+ optional:
+ description: Specify whether the Secret or its key must
+ be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ x-kubernetes-map-type: atomic
+ tlsMinVersion:
+ description: TLSMinVersion minimum supported TLS version
+ type: string
+ useProxyProtocol:
+ description: |-
+ UseProxyProtocol enables proxy protocol for connections accepted at this listener
+ see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+ type: boolean
+ required:
+ - addr
+ - name
+ type: object
+ type: array
image:
description: |-
Image - docker image settings
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index b1323c8676..79a83bd103 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,6 +13,8 @@ aliases:
## tip
+**Update note 1**: [vmoperator](https://docs.victoriametrics.com/operator/): as part of `spec.httpListeners` support (see below), the `api` Go module's package-level helpers `BuildLocalURL` and `HTTPProtoFromFlags` were removed from `api/operator/v1beta1` in favor of the `StandardAppsParams.BuildLocalURL` method and the package-level `Scheme`/`ProbeSchemeFromTLS` functions; `UseProxyProtocol` remains, alongside the new `StandardAppsParams.UseProxyProtocol` method. The same feature also replaced the embedded `CommonAppsParams` field with `StandardAppsParams` on `VMAgentSpec`, `VMSingleSpec`, `VMAuthSpec`, `VMAlertSpec`, `VLAgentSpec`, `VLSingleSpec`, `VTAgentSpec`, `VTSingleSpec`, `VMDistributedZoneAgentSpec`/`VLDistributedSpec` (`api/operator/v1alpha1`), and the `VMInsert`/`VMSelect`/`VMStorage` sub-specs of `VMClusterSpec` and the `VLSelect`/`VLInsert`/`VLStorage`/`VTSelect`/`VTInsert`/`VTStorage` sub-specs of `VLClusterSpec`/`VTClusterSpec`; a `CommonAppsParams:` field literal against any of these needs to become `StandardAppsParams:`. `OTLPGRPCSpec.Validate` (`api/operator/v1`) also gained a second `listeners []vmv1beta1.HTTPListener` parameter. This only affects direct Go consumers of the `api` module — the CRD schema and existing YAML manifests are unaffected.
+
* Dependency: [vmoperator](https://docs.victoriametrics.com/operator/): Updated default versions for VM apps to [v1.151.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.151.0) version
* Dependency: [vmoperator](https://docs.victoriametrics.com/operator/): Updated default versions for VMAnomaly to [v1.30.4](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1304) version
* Dependency: [vmoperator](https://docs.victoriametrics.com/operator/): Updated default versions for VT apps to [v0.11.0](https://github.com/VictoriaMetrics/VictoriaTraces/releases/tag/v0.11.0) version
@@ -25,6 +27,7 @@ aliases:
* FEATURE: [vtagent](https://docs.victoriametrics.com/operator/resources/vtagent/), [vtsingle](https://docs.victoriametrics.com/operator/resources/vtsingle/), [vtcluster](https://docs.victoriametrics.com/operator/resources/vtcluster/): add `grpcSpec` field (`spec.insert.grpcSpec` for `VTCluster`) to accept OTLP trace spans over gRPC in addition to HTTP, with optional TLS via `tlsConfig`. See [#2510](https://github.com/VictoriaMetrics/operator/pull/2510).
* FEATURE: [vlagent](https://docs.victoriametrics.com/operator/resources/vlagent/), [vlsingle](https://docs.victoriametrics.com/operator/resources/vlsingle/), [vlcluster](https://docs.victoriametrics.com/operator/resources/vlcluster/): add `cipherSuites` and `minVersion` fields to syslog listener `tlsConfig`. See [#2510](https://github.com/VictoriaMetrics/operator/pull/2510).
* FEATURE: [vlsingle](https://docs.victoriametrics.com/operator/resources/vlsingle/), [vtsingle](https://docs.victoriametrics.com/operator/resources/vtsingle/): add `removePvcAfterDelete` field to support PVC cleanup after deletion. See [#2545](https://github.com/VictoriaMetrics/operator/pull/2545).
+* FEATURE: [vmagent](https://docs.victoriametrics.com/operator/resources/vmagent/), [vmalert](https://docs.victoriametrics.com/operator/resources/vmalert/), [vmauth](https://docs.victoriametrics.com/operator/resources/vmauth/), [vmsingle](https://docs.victoriametrics.com/operator/resources/vmsingle/), [vmcluster](https://docs.victoriametrics.com/operator/resources/vmcluster/), [vlsingle](https://docs.victoriametrics.com/operator/resources/vlsingle/), [vlagent](https://docs.victoriametrics.com/operator/resources/vlagent/), [vlcluster](https://docs.victoriametrics.com/operator/resources/vlcluster/), [vtagent](https://docs.victoriametrics.com/operator/resources/vtagent/), [vtsingle](https://docs.victoriametrics.com/operator/resources/vtsingle/), [vtcluster](https://docs.victoriametrics.com/operator/resources/vtcluster/): add `spec.httpListeners` field (array of `HTTPListener`) to configure one or more HTTP listen addresses per component, each with independent TLS, mTLS and proxy-protocol settings. When no listeners are specified the operator synthesizes a default listener from `spec.port`, preserving backward compatibility. The `spec.useProxyProtocol` field on `VMAuth` is deprecated in favour of `spec.httpListeners[].useProxyProtocol`. See [#2346](https://github.com/VictoriaMetrics/operator/issues/2346).
* BUGFIX: [vmagent](https://docs.victoriametrics.com/operator/resources/vmagent/), [vmanomaly](https://docs.victoriametrics.com/operator/resources/vmanomaly/): default `spec.shardCount` to `0` at the CRD schema level, fixing `VerticalPodAutoscaler`'s `/scale` subresource lookups failing with `the spec replicas field ".spec.shardCount" does not exist` whenever sharding wasn't configured (the common case). See [#2473](https://github.com/VictoriaMetrics/operator/issues/2473).
* BUGFIX: [vmoperator](https://docs.victoriametrics.com/operator/): set default values for each possible `level` label of `operator_log_messages_total` metric. See [#2477](https://github.com/VictoriaMetrics/operator/issues/2477).
diff --git a/docs/api.md b/docs/api.md
index 5e1002b3fc..87f1422862 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -251,6 +251,7 @@ Appears in: [VLAgent (v1)](#v1-vlagent)
| hostAliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. |
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -359,6 +360,7 @@ Appears in: [VLClusterSpec (v1)](#v1-vlclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -424,6 +426,7 @@ Appears in: [VLClusterSpec (v1)](#v1-vlclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -500,6 +503,7 @@ Appears in: [VLDistributedZoneSingle (v1alpha1)](#v1alpha1-vldistributedzonesing
| hostAliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. |
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -575,6 +579,7 @@ Appears in: [VLClusterSpec (v1)](#v1-vlclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling.
Note, downscaling is not supported. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -953,6 +958,7 @@ Appears in: [VTAgent (v1)](#v1-vtagent)
| hostAliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. |
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -1057,6 +1063,7 @@ Appears in: [VTClusterSpec (v1)](#v1-vtclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -1121,6 +1128,7 @@ Appears in: [VTClusterSpec (v1)](#v1-vtclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -1198,6 +1206,7 @@ Appears in: [VTSingle (v1)](#v1-vtsingle)
| hostAliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. |
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -1271,6 +1280,7 @@ Appears in: [VTClusterSpec (v1)](#v1-vtclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling.
Note, downscaling is not supported. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -1461,6 +1471,7 @@ Appears in: [VLDistributedZoneAgent (v1alpha1)](#v1alpha1-vldistributedzoneagent
| hostAliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. |
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -1673,6 +1684,7 @@ Appears in: [VMDistributedZoneAgent (v1alpha1)](#v1alpha1-vmdistributedzoneagent
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -1962,6 +1974,7 @@ Appears in: [TargetRef (v1beta1)](#v1beta1-targetref)
| Field | Description |
| --- | --- |
| kind#
_string_ | _(Required)_
Kind one of:
VMAgent,VMAlert, VMSingle, VMCluster/vmselect, VMCluster/vmstorage,VMCluster/vminsert,VMAlertManager, VLSingle, VLCluster/vlinsert, VLCluster/vlselect, VLCluster/vlstorage, VTSingle, VTCluster/vtinsert, VTCluster/vtselect, VTCluster/vtstorage VMAnomaly and VLAgent |
+| listenerName#
_string_ | _(Optional)_
ListenerName selects a specific HTTPListener by name on the target CRD.
When set, the proxy URL scheme and port are taken from that listener's
TLS and Addr fields. Falls back to the CRD's primary listener when empty.
Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
VMAnomaly, or VLogs, since those specs have no HTTPListeners. |
| name#
_string_ | _(Required)_
Name of the target Kubernetes object |
| namespace#
_string_ | _(Required)_
Namespace of the target Kubernetes object |
| objects#
_[NamespacedName (v1beta1)](#v1beta1-namespacedname) array_ | _(Optional)_
Objects defines list of name/namespace pairs that define existing k8s object |
@@ -1987,7 +2000,7 @@ Appears in: [TLSClientConfig (v1beta1)](#v1beta1-tlsclientconfig), [TLSServerCon
CommonAppsParams defines common params
for deployment and statefulset specifications
-Appears in: [VLAgentSpec (v1)](#v1-vlagentspec), [VLDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vldistributedzoneagentspec), [VLInsert (v1)](#v1-vlinsert), [VLSelect (v1)](#v1-vlselect), [VLSingleSpec (v1)](#v1-vlsinglespec), [VLStorage (v1)](#v1-vlstorage), [VLogsSpec (v1beta1)](#v1beta1-vlogsspec), [VMAgentSpec (v1beta1)](#v1beta1-vmagentspec), [VMAlertSpec (v1beta1)](#v1beta1-vmalertspec), [VMAlertmanagerSpec (v1beta1)](#v1beta1-vmalertmanagerspec), [VMAnomalySpec (v1)](#v1-vmanomalyspec), [VMAuthLoadBalancerSpec (v1beta1)](#v1beta1-vmauthloadbalancerspec), [VMAuthSpec (v1beta1)](#v1beta1-vmauthspec), [VMDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vmdistributedzoneagentspec), [VMInsert (v1beta1)](#v1beta1-vminsert), [VMSelect (v1beta1)](#v1beta1-vmselect), [VMSingleSpec (v1beta1)](#v1beta1-vmsinglespec), [VMStorage (v1beta1)](#v1beta1-vmstorage), [VTAgentSpec (v1)](#v1-vtagentspec), [VTInsert (v1)](#v1-vtinsert), [VTSelect (v1)](#v1-vtselect), [VTSingleSpec (v1)](#v1-vtsinglespec), [VTStorage (v1)](#v1-vtstorage)
+Appears in: [StandardAppsParams (v1beta1)](#v1beta1-standardappsparams), [VLAgentSpec (v1)](#v1-vlagentspec), [VLDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vldistributedzoneagentspec), [VLInsert (v1)](#v1-vlinsert), [VLSelect (v1)](#v1-vlselect), [VLSingleSpec (v1)](#v1-vlsinglespec), [VLStorage (v1)](#v1-vlstorage), [VLogsSpec (v1beta1)](#v1beta1-vlogsspec), [VMAgentSpec (v1beta1)](#v1beta1-vmagentspec), [VMAlertSpec (v1beta1)](#v1beta1-vmalertspec), [VMAlertmanagerSpec (v1beta1)](#v1beta1-vmalertmanagerspec), [VMAnomalySpec (v1)](#v1-vmanomalyspec), [VMAuthLoadBalancerSpec (v1beta1)](#v1beta1-vmauthloadbalancerspec), [VMAuthSpec (v1beta1)](#v1beta1-vmauthspec), [VMDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vmdistributedzoneagentspec), [VMInsert (v1beta1)](#v1beta1-vminsert), [VMSelect (v1beta1)](#v1beta1-vmselect), [VMSingleSpec (v1beta1)](#v1beta1-vmsinglespec), [VMStorage (v1beta1)](#v1beta1-vmstorage), [VTAgentSpec (v1)](#v1-vtagentspec), [VTInsert (v1)](#v1-vtinsert), [VTSelect (v1)](#v1-vtselect), [VTSingleSpec (v1)](#v1-vtsinglespec), [VTStorage (v1)](#v1-vtstorage)
| Field | Description |
| --- | --- |
@@ -2748,6 +2761,32 @@ Appears in: [HTTPConfig (v1beta1)](#v1beta1-httpconfig)
| secrets
_[SecretKeySelector (v1)](#v1-secretkeyselector) array_ | _(Optional)_
Secrets are header values read from Kubernetes Secrets. |
| values
_string array_ | _(Optional)_
Values are literal header values to send as-is. |
+#### HTTPListener {#v1beta1-httplistener}
+
+
+HTTPListener defines configuration for an HTTP listen address
+
+Appears in: [StandardAppsParams (v1beta1)](#v1beta1-standardappsparams), [VLAgentSpec (v1)](#v1-vlagentspec), [VLDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vldistributedzoneagentspec), [VLInsert (v1)](#v1-vlinsert), [VLSelect (v1)](#v1-vlselect), [VLSingleSpec (v1)](#v1-vlsinglespec), [VLStorage (v1)](#v1-vlstorage), [VMAgentSpec (v1beta1)](#v1beta1-vmagentspec), [VMAlertSpec (v1beta1)](#v1beta1-vmalertspec), [VMAuthSpec (v1beta1)](#v1beta1-vmauthspec), [VMDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vmdistributedzoneagentspec), [VMInsert (v1beta1)](#v1beta1-vminsert), [VMSelect (v1beta1)](#v1beta1-vmselect), [VMSingleSpec (v1beta1)](#v1beta1-vmsinglespec), [VMStorage (v1beta1)](#v1beta1-vmstorage), [VTAgentSpec (v1)](#v1-vtagentspec), [VTInsert (v1)](#v1-vtinsert), [VTSelect (v1)](#v1-vtselect), [VTSingleSpec (v1)](#v1-vtsinglespec), [VTStorage (v1)](#v1-vtstorage)
+
+| Field | Description |
+| --- | --- |
+| addr#
_string_ | _(Required)_
Addr is the TCP address to listen for incoming HTTP requests, e.g. :8428 |
+| mtls#
_boolean_ | _(Optional)_
MTLS enables mutual TLS authentication |
+| mtlsCAFile#
_string_ | _(Optional)_
MTLSCAFile path to the pre-mounted CA certificate file for mTLS.
Mutually exclusive with MTLSCASecret. |
+| mtlsCASecret#
_[SecretKeySelector (v1)](#v1-secretkeyselector)_ | _(Optional)_
MTLSCASecret reference to a Kubernetes Secret containing the CA certificate for mTLS under the specified key.
Mutually exclusive with MTLSCAFile. |
+| name#
_string_ | _(Required)_
Name is the listener name, used for Kubernetes Service port naming. |
+| primary#
_boolean_ | _(Optional)_
Primary marks this listener as the probe target when multiple listeners
are configured. If no listener is marked primary, the first listener is used. |
+| tls#
_boolean_ | _(Optional)_
TLS enables TLS for the listener |
+| tlsAutocertCacheDir#
_string_ | _(Optional)_
TLSAutocertCacheDir directory for caching automatically issued TLS certificates |
+| tlsAutocertEmail#
_string_ | _(Optional)_
TLSAutocertEmail contact email for automatic TLS certificate issuance |
+| tlsAutocertHosts#
_string_ | _(Optional)_
TLSAutocertHosts enables automatic TLS certificate issuance for the listed hosts |
+| tlsCertFile#
_string_ | _(Optional)_
TLSCertFile path to the pre-mounted server TLS certificate file.
Mutually exclusive with TLSCertSecret. |
+| tlsCertSecret#
_[SecretKeySelector (v1)](#v1-secretkeyselector)_ | _(Optional)_
TLSCertSecret reference to a Kubernetes Secret containing the server TLS certificate under the specified key.
Mutually exclusive with TLSCertFile. |
+| tlsKeyFile#
_string_ | _(Optional)_
TLSKeyFile path to the pre-mounted server TLS private key file.
Mutually exclusive with TLSKeySecret. |
+| tlsKeySecret#
_[SecretKeySelector (v1)](#v1-secretkeyselector)_ | _(Optional)_
TLSKeySecret reference to a Kubernetes Secret containing the server TLS private key under the specified key.
Mutually exclusive with TLSKeyFile. |
+| tlsMinVersion#
_string_ | _(Optional)_
TLSMinVersion minimum supported TLS version |
+| useProxyProtocol#
_boolean_ | _(Optional)_
UseProxyProtocol enables proxy protocol for connections accepted at this listener
see https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt |
+
#### HTTPSDConfig {#v1beta1-httpsdconfig}
@@ -2810,7 +2849,7 @@ Appears in: [VMScrapeConfigSpec (v1beta1)](#v1beta1-vmscrapeconfigspec)
Image defines docker image settings
-Appears in: [CommonAppsParams (v1beta1)](#v1beta1-commonappsparams), [VLAgentSpec (v1)](#v1-vlagentspec), [VLDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vldistributedzoneagentspec), [VLInsert (v1)](#v1-vlinsert), [VLSelect (v1)](#v1-vlselect), [VLSingleSpec (v1)](#v1-vlsinglespec), [VLStorage (v1)](#v1-vlstorage), [VLogsSpec (v1beta1)](#v1beta1-vlogsspec), [VMAgentSpec (v1beta1)](#v1beta1-vmagentspec), [VMAlertSpec (v1beta1)](#v1beta1-vmalertspec), [VMAlertmanagerSpec (v1beta1)](#v1beta1-vmalertmanagerspec), [VMAnomalySpec (v1)](#v1-vmanomalyspec), [VMAuthLoadBalancerSpec (v1beta1)](#v1beta1-vmauthloadbalancerspec), [VMAuthSpec (v1beta1)](#v1beta1-vmauthspec), [VMBackup (v1beta1)](#v1beta1-vmbackup), [VMDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vmdistributedzoneagentspec), [VMInsert (v1beta1)](#v1beta1-vminsert), [VMSelect (v1beta1)](#v1beta1-vmselect), [VMSingleSpec (v1beta1)](#v1beta1-vmsinglespec), [VMStorage (v1beta1)](#v1beta1-vmstorage), [VTAgentSpec (v1)](#v1-vtagentspec), [VTInsert (v1)](#v1-vtinsert), [VTSelect (v1)](#v1-vtselect), [VTSingleSpec (v1)](#v1-vtsinglespec), [VTStorage (v1)](#v1-vtstorage)
+Appears in: [CommonAppsParams (v1beta1)](#v1beta1-commonappsparams), [StandardAppsParams (v1beta1)](#v1beta1-standardappsparams), [VLAgentSpec (v1)](#v1-vlagentspec), [VLDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vldistributedzoneagentspec), [VLInsert (v1)](#v1-vlinsert), [VLSelect (v1)](#v1-vlselect), [VLSingleSpec (v1)](#v1-vlsinglespec), [VLStorage (v1)](#v1-vlstorage), [VLogsSpec (v1beta1)](#v1beta1-vlogsspec), [VMAgentSpec (v1beta1)](#v1beta1-vmagentspec), [VMAlertSpec (v1beta1)](#v1beta1-vmalertspec), [VMAlertmanagerSpec (v1beta1)](#v1beta1-vmalertmanagerspec), [VMAnomalySpec (v1)](#v1-vmanomalyspec), [VMAuthLoadBalancerSpec (v1beta1)](#v1beta1-vmauthloadbalancerspec), [VMAuthSpec (v1beta1)](#v1beta1-vmauthspec), [VMBackup (v1beta1)](#v1beta1-vmbackup), [VMDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vmdistributedzoneagentspec), [VMInsert (v1beta1)](#v1beta1-vminsert), [VMSelect (v1beta1)](#v1beta1-vmselect), [VMSingleSpec (v1beta1)](#v1beta1-vmsinglespec), [VMStorage (v1beta1)](#v1beta1-vmstorage), [VTAgentSpec (v1)](#v1-vtagentspec), [VTInsert (v1)](#v1-vtinsert), [VTSelect (v1)](#v1-vtselect), [VTSingleSpec (v1)](#v1-vtsinglespec), [VTStorage (v1)](#v1-vtstorage)
| Field | Description |
| --- | --- |
@@ -3166,6 +3205,7 @@ Appears in: [CRDRef (v1beta1)](#v1beta1-crdref)
| Field | Description |
| --- | --- |
+| listenerName#
_string_ | _(Optional)_
ListenerName selects a specific HTTPListener by name on the target CRD.
When set, the proxy URL scheme and port are taken from that listener's
TLS and Addr fields. Falls back to the CRD's primary listener when empty.
Not supported when crd.kind is VMAlertmanager (or its VMAlertManager alias),
VMAnomaly, or VLogs, since those specs have no HTTPListeners. |
| name#
_string_ | _(Required)_
Name of the target Kubernetes object |
| namespace#
_string_ | _(Required)_
Namespace of the target Kubernetes object |
| useExtraService
_boolean_ | _(Optional)_
UseExtraService instructs the operator to prefer the CR's additional service
(created via spec.serviceSpec) over the default service when building the target URL. |
@@ -3712,7 +3752,7 @@ Appears in: [OAuth2 (v1beta1)](#v1beta1-oauth2), [TLSConfig (v1beta1)](#v1beta1-
SecurityContext extends PodSecurityContext with ContainerSecurityContext
It allows to globally configure security params for pod and all containers
-Appears in: [CommonAppsParams (v1beta1)](#v1beta1-commonappsparams), [VLAgentSpec (v1)](#v1-vlagentspec), [VLDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vldistributedzoneagentspec), [VLInsert (v1)](#v1-vlinsert), [VLSelect (v1)](#v1-vlselect), [VLSingleSpec (v1)](#v1-vlsinglespec), [VLStorage (v1)](#v1-vlstorage), [VLogsSpec (v1beta1)](#v1beta1-vlogsspec), [VMAgentSpec (v1beta1)](#v1beta1-vmagentspec), [VMAlertSpec (v1beta1)](#v1beta1-vmalertspec), [VMAlertmanagerSpec (v1beta1)](#v1beta1-vmalertmanagerspec), [VMAnomalySpec (v1)](#v1-vmanomalyspec), [VMAuthLoadBalancerSpec (v1beta1)](#v1beta1-vmauthloadbalancerspec), [VMAuthSpec (v1beta1)](#v1beta1-vmauthspec), [VMDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vmdistributedzoneagentspec), [VMInsert (v1beta1)](#v1beta1-vminsert), [VMSelect (v1beta1)](#v1beta1-vmselect), [VMSingleSpec (v1beta1)](#v1beta1-vmsinglespec), [VMStorage (v1beta1)](#v1beta1-vmstorage), [VTAgentSpec (v1)](#v1-vtagentspec), [VTInsert (v1)](#v1-vtinsert), [VTSelect (v1)](#v1-vtselect), [VTSingleSpec (v1)](#v1-vtsinglespec), [VTStorage (v1)](#v1-vtstorage)
+Appears in: [CommonAppsParams (v1beta1)](#v1beta1-commonappsparams), [StandardAppsParams (v1beta1)](#v1beta1-standardappsparams), [VLAgentSpec (v1)](#v1-vlagentspec), [VLDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vldistributedzoneagentspec), [VLInsert (v1)](#v1-vlinsert), [VLSelect (v1)](#v1-vlselect), [VLSingleSpec (v1)](#v1-vlsinglespec), [VLStorage (v1)](#v1-vlstorage), [VLogsSpec (v1beta1)](#v1beta1-vlogsspec), [VMAgentSpec (v1beta1)](#v1beta1-vmagentspec), [VMAlertSpec (v1beta1)](#v1beta1-vmalertspec), [VMAlertmanagerSpec (v1beta1)](#v1beta1-vmalertmanagerspec), [VMAnomalySpec (v1)](#v1-vmanomalyspec), [VMAuthLoadBalancerSpec (v1beta1)](#v1beta1-vmauthloadbalancerspec), [VMAuthSpec (v1beta1)](#v1beta1-vmauthspec), [VMDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vmdistributedzoneagentspec), [VMInsert (v1beta1)](#v1beta1-vminsert), [VMSelect (v1beta1)](#v1beta1-vmselect), [VMSingleSpec (v1beta1)](#v1beta1-vmsinglespec), [VMStorage (v1beta1)](#v1beta1-vmstorage), [VTAgentSpec (v1)](#v1-vtagentspec), [VTInsert (v1)](#v1-vtinsert), [VTSelect (v1)](#v1-vtselect), [VTSingleSpec (v1)](#v1-vtsinglespec), [VTStorage (v1)](#v1-vtstorage)
#### Sigv4Config {#v1beta1-sigv4config}
@@ -3814,6 +3854,59 @@ Appears in: [SlackConfig (v1beta1)](#v1beta1-slackconfig)
| title#
_string_ | _(Required)_
|
| value#
_string_ | _(Required)_
|
+#### StandardAppsParams {#v1beta1-standardappsparams}
+
+
+StandardAppsParams extends CommonAppsParams for standard Go-binary applications
+that expose one or more HTTP listeners via -httpListenAddr flags.
+
+Appears in: [VLAgentSpec (v1)](#v1-vlagentspec), [VLDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vldistributedzoneagentspec), [VLInsert (v1)](#v1-vlinsert), [VLSelect (v1)](#v1-vlselect), [VLSingleSpec (v1)](#v1-vlsinglespec), [VLStorage (v1)](#v1-vlstorage), [VMAgentSpec (v1beta1)](#v1beta1-vmagentspec), [VMAlertSpec (v1beta1)](#v1beta1-vmalertspec), [VMAuthSpec (v1beta1)](#v1beta1-vmauthspec), [VMDistributedZoneAgentSpec (v1alpha1)](#v1alpha1-vmdistributedzoneagentspec), [VMInsert (v1beta1)](#v1beta1-vminsert), [VMSelect (v1beta1)](#v1beta1-vmselect), [VMSingleSpec (v1beta1)](#v1beta1-vmsinglespec), [VMStorage (v1beta1)](#v1beta1-vmstorage), [VTAgentSpec (v1)](#v1-vtagentspec), [VTInsert (v1)](#v1-vtinsert), [VTSelect (v1)](#v1-vtselect), [VTSingleSpec (v1)](#v1-vtsinglespec), [VTStorage (v1)](#v1-vtstorage)
+
+| Field | Description |
+| --- | --- |
+| affinity#
_[Affinity (v1)](#v1-affinity)_ | _(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 |
+| containers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
Containers property allows to inject additions sidecars or to patch existing containers.
It can be useful for proxies, backup, etc. |
+| disableAutomountServiceAccountToken#
_boolean_ | _(Optional)_
DisableAutomountServiceAccountToken whether to disable serviceAccount auto mount by Kubernetes
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.
Available from: v0.54.0 |
+| disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable |
+| dnsConfig#
_[PodDNSConfig (v1)](#v1-poddnsconfig)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. |
+| dnsPolicy#
_[DNSPolicy (v1)](#v1-dnspolicy)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod |
+| enableServiceLinks#
_boolean_ | _(Optional)_
EnableServiceLinks indicates whether information about services should be injected into pod's
environment variables, matching the syntax of Docker links.
Optional: Defaults to true. |
+| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp |
+| extraEnvs#
_[EnvVar (v1)](#v1-envvar) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container |
+| extraEnvsFrom#
_[EnvFromSource (v1)](#v1-envfromsource) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap |
+| hostAliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. |
+| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
+| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
+| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
+| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
+| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
+| livenessProbe#
_[Probe (v1)](#v1-probe)_ | _(Optional)_
LivenessProbe that will be added to CR pod |
+| minReadySeconds#
_integer_ | _(Optional)_
MinReadySeconds defines a minimum number of seconds to wait before starting update next pod
if previous in healthy state
Has no effect for VLogs and VMSingle |
+| nodeSelector#
_object (keys:string, values:string)_ | _(Optional)_
NodeSelector Define which Nodes the Pods are scheduled on. |
+| paused#
_boolean_ | _(Optional)_
Paused If set to true all actions on the underlying managed objects are not
going to be performed, except for delete actions. |
+| port#
_string_ | _(Optional)_
Port listen address |
+| preStopSleepSeconds#
_integer_ | _(Optional)_
PreStopSleepSeconds defines the number of seconds to sleep in the preStop lifecycle hook.
It gives time for load balancers to remove the pod from rotation before the pod is terminated.
Defaults to 15 for applicable components. Set to 0 to disable. |
+| priorityClassName#
_string_ | _(Optional)_
PriorityClassName class assigned to the Pods |
+| readinessGates#
_[PodReadinessGate (v1)](#v1-podreadinessgate) array_ | _(Required)_
ReadinessGates defines pod readiness gates |
+| readinessProbe#
_[Probe (v1)](#v1-probe)_ | _(Optional)_
ReadinessProbe that will be added to CR pod |
+| replicaCount#
_integer_ | _(Optional)_
ReplicaCount is the expected size of the Application. |
+| resources#
_[ResourceRequirements (v1)](#v1-resourcerequirements)_ | _(Optional)_
Resources 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 |
+| revisionHistoryLimitCount#
_integer_ | _(Optional)_
The number of old ReplicaSets to retain to allow rollback in deployment or
maximum number of revisions that will be maintained in the Deployment revision history.
Has no effect at StatefulSets
Defaults to 10. |
+| runtimeClassName#
_string_ | _(Optional)_
RuntimeClassName - defines runtime class for kubernetes pod.
https://kubernetes.io/docs/concepts/containers/runtime-class/ |
+| schedulerName#
_string_ | _(Optional)_
SchedulerName - defines kubernetes scheduler name |
+| secrets#
_string array_ | _(Optional)_
Secrets is a list of Secrets in the same namespace as the Application
object, which shall be mounted into the Application container
at /etc/vm/secrets/SECRET_NAME folder |
+| securityContext#
_[SecurityContext (v1beta1)](#v1beta1-securitycontext)_ | _(Optional)_
SecurityContext holds pod-level security attributes and common container settings.
This defaults to the default PodSecurityContext. |
+| startupProbe#
_[Probe (v1)](#v1-probe)_ | _(Optional)_
StartupProbe that will be added to CR pod |
+| terminationGracePeriodSeconds#
_integer_ | _(Optional)_
TerminationGracePeriodSeconds period for container graceful termination |
+| tolerations#
_[Toleration (v1)](#v1-toleration) array_ | _(Optional)_
Tolerations If specified, the pod's tolerations. |
+| topologySpreadConstraints#
_[TopologySpreadConstraint (v1)](#v1-topologyspreadconstraint) array_ | _(Optional)_
TopologySpreadConstraints embedded kubernetes pod configuration option,
controls how pods are spread across your cluster among failure-domains
such as regions, zones, nodes, and other user-defined topology domains
https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/ |
+| useDefaultResources#
_boolean_ | _(Optional)_
UseDefaultResources controls resource settings
By default, operator sets built-in resource requirements |
+| useStrictSecurity#
_boolean_ | _(Optional)_
UseStrictSecurity enables strict security mode for component
it restricts disk writes access
uses non-root user out of the box
drops not needed security permissions |
+| volumeMounts#
_[VolumeMount (v1)](#v1-volumemount) array_ | _(Optional)_
VolumeMounts allows configuration of additional VolumeMounts on the output Deployment/StatefulSet definition.
VolumeMounts specified will be appended to other VolumeMounts in the Application container |
+| volumes#
_[Volume (v1)](#v1-volume) array_ | _(Optional)_
Volumes allows configuration of additional volumes on the output Deployment/StatefulSet definition.
Volumes specified will be appended to other volumes that are generated. |
+
#### StatefulSetUpdateStrategyBehavior {#v1beta1-statefulsetupdatestrategybehavior}
@@ -4335,6 +4428,7 @@ Appears in: [VMAgent (v1beta1)](#v1beta1-vmagent)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| ignoreNamespaceSelectors#
_boolean_ | _(Optional)_
IgnoreNamespaceSelectors if set to true will ignore NamespaceSelector settings from
scrape objects, and they will only discover endpoints
within their current namespace. Defaults to false. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
@@ -4532,6 +4626,7 @@ Appears in: [VMAlert (v1beta1)](#v1beta1-vmalert)
| hostAliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. |
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -4905,6 +5000,7 @@ Appears in: [DistributedAuth (v1alpha1)](#v1alpha1-distributedauth), [VMAuth (v1
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| httpRoute#
_[EmbeddedHTTPRoute (v1beta1)](#v1beta1-embeddedhttproute)_ | _(Required)_
HTTPRoute enables httproute configuration for VMAuth. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
@@ -4954,7 +5050,7 @@ Appears in: [DistributedAuth (v1alpha1)](#v1alpha1-distributedauth), [VMAuth (v1
| updateStrategy#
_[DeploymentStrategyType (v1)](#v1-deploymentstrategytype)_ | _(Optional)_
UpdateStrategy - overrides default update strategy.
Available from: v0.64.0 |
| useDefaultResources#
_boolean_ | _(Optional)_
UseDefaultResources controls resource settings
By default, operator sets built-in resource requirements |
| useLegacyNaming#
_boolean_ | _(Optional)_
UseLegacyNaming uses standalone Helm chart naming for managed resources:
the CR name is used directly instead of the default "-" convention.
Available from: v0.73.0 |
-| useProxyProtocol#
_boolean_ | _(Required)_
UseProxyProtocol enables proxy protocol for vmauth
https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt |
+| useProxyProtocol#
_boolean_ | _(Required)_
UseProxyProtocol enables proxy protocol for vmauth
https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt
Deprecated: since version v0.74.0 use httpListeners instead
|
| useStrictSecurity#
_boolean_ | _(Optional)_
UseStrictSecurity enables strict security mode for component
it restricts disk writes access
uses non-root user out of the box
drops not needed security permissions |
| useVMConfigReloader#
_boolean_ | _(Optional)_
UseVMConfigReloader replaces prometheus-like config-reloader
with vm one. It uses secrets watch instead of file watch
which greatly increases speed of config updates
Deprecated: will be removed in v0.67.0
|
| userNamespaceSelector#
_[LabelSelector (v1)](#v1-labelselector)_ | _(Optional)_
UserNamespaceSelector Namespaces to be selected for VMAuth discovery.
Works in combination with Selector.
NamespaceSelector nil - only objects at VMAuth namespace.
Selector nil - only objects at NamespaceSelector namespaces.
If both nil - behaviour controlled by selectAllByDefault |
@@ -5099,6 +5195,7 @@ Appears in: [VMClusterSpec (v1beta1)](#v1beta1-vmclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Required)_
HPA defines kubernetes PodAutoScaling configuration version 2. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -5488,6 +5585,7 @@ Appears in: [VMClusterSpec (v1beta1)](#v1beta1-vmclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling.
Note, enabling this option disables vmselect to vmselect communication. In most cases it's not an issue. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
@@ -5615,6 +5713,7 @@ Appears in: [VMDistributedZoneSingle (v1alpha1)](#v1alpha1-vmdistributedzonesing
| hostAliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. |
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| ignoreNamespaceSelectors#
_boolean_ | _(Optional)_
IgnoreNamespaceSelectors if set to true will ignore NamespaceSelector settings from
scrape objects, and they will only discover endpoints
within their current namespace. Defaults to false. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
@@ -5748,6 +5847,7 @@ Appears in: [VMClusterSpec (v1beta1)](#v1beta1-vmclusterspec)
| hostNetwork#
_boolean_ | _(Optional)_
HostNetwork controls whether the pod may use the node network namespace |
| host_aliases#
_[HostAlias (v1)](#v1-hostalias) array_ | _(Optional)_
HostAliasesUnderScore provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork.
Has Priority over hostAliases field |
| hpa#
_[EmbeddedHPA (v1beta1)](#v1beta1-embeddedhpa)_ | _(Optional)_
Configures horizontal pod autoscaling.
Note, downscaling is not supported. |
+| httpListeners#
_[HTTPListener (v1beta1)](#v1beta1-httplistener) array_ | _(Optional)_
HTTPListeners configures HTTP listen addresses with optional per-listener
TLS and proxy protocol settings. When set, takes precedence over Port for
service port and argument generation. |
| image#
_[Image (v1beta1)](#v1beta1-image)_ | _(Optional)_
Image - docker image settings
if no specified operator uses default version from operator config |
| imagePullSecrets#
_[LocalObjectReference (v1)](#v1-localobjectreference) array_ | _(Optional)_
ImagePullSecrets An optional list of references to secrets in the same namespace
to use for pulling images from registries
see https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| initContainers#
_[Container (v1)](#v1-container) array_ | _(Optional)_
InitContainers allows adding initContainers to the pod definition.
Any errors during the execution of an initContainer will lead to a restart of the Pod.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
diff --git a/docs/config.yaml b/docs/config.yaml
index e2ebde8f03..47ff820735 100644
--- a/docs/config.yaml
+++ b/docs/config.yaml
@@ -18,6 +18,8 @@ processor:
- "StatusMetadata"
- "Condition"
- "SubRoute"
+ - "ParentOpts"
+ - "ClusterComponent"
ignoreFields:
- "status$"
- "TypeMeta$"
diff --git a/internal/controller/operator/factory/build/backup.go b/internal/controller/operator/factory/build/backup.go
index 231ccb4eeb..40a407a3c2 100644
--- a/internal/controller/operator/factory/build/backup.go
+++ b/internal/controller/operator/factory/build/backup.go
@@ -17,36 +17,45 @@ import (
const vmBackuperCreds = "/etc/vm/creds"
+// backupCRD is implemented by applications that support a vmbackupmanager sidecar.
+type backupCRD interface {
+ Backup() *vmv1beta1.VMBackup
+ SnapshotCreatePath(host string) string
+ SnapshotDeletePath(host string) string
+}
+
// VMBackupManager conditionally creates vmbackupmanager container
func VMBackupManager(
ctx context.Context,
- cr *vmv1beta1.VMBackup,
- port string,
+ cr backupCRD,
storagePath string,
mounts []corev1.VolumeMount,
- extraArgs map[string]string,
isCluster bool,
license *vmv1beta1.License,
) (*corev1.Container, error) {
- if !cr.AcceptEULA && !license.IsProvided() {
+ vmBackup := cr.Backup()
+ if vmBackup == nil {
+ return nil, nil
+ }
+ if !vmBackup.AcceptEULA && !license.IsProvided() {
logger.WithContext(ctx).Info("EULA or license wasn't defined, update your backup settings." +
" Follow https://docs.victoriametrics.com/victoriametrics/enterprise for further instructions.")
return nil, nil
}
- snapshotCreateURL := cr.SnapshotCreateURL
- snapshotDeleteURL := cr.SnapshotDeleteURL
+ snapshotCreateURL := vmBackup.SnapshotCreateURL
+ snapshotDeleteURL := vmBackup.SnapshotDeleteURL
if snapshotCreateURL == "" {
// http://localhost:port/snapshot/create
- snapshotCreateURL = cr.SnapshotCreatePathWithFlags(config.GetLocalhost(), port, extraArgs)
+ snapshotCreateURL = cr.SnapshotCreatePath(config.GetLocalhost())
}
if snapshotDeleteURL == "" {
// http://localhost:port/snapshot/delete
- snapshotDeleteURL = cr.SnapshotDeletePathWithFlags(config.GetLocalhost(), port, extraArgs)
+ snapshotDeleteURL = cr.SnapshotDeletePath(config.GetLocalhost())
}
- backupDst := cr.Destination
+ backupDst := vmBackup.Destination
// add suffix with pod name for cluster backupmanager
// it's needed to create consistent backup across cluster nodes
- if isCluster && !cr.DestinationDisableSuffixAdd {
+ if isCluster && !vmBackup.DestinationDisableSuffixAdd {
backupDst = strings.TrimSuffix(backupDst, "/") + "/$(POD_NAME)/"
}
args := []string{
@@ -55,38 +64,38 @@ func VMBackupManager(
fmt.Sprintf("-snapshot.createURL=%s", snapshotCreateURL),
fmt.Sprintf("-snapshot.deleteURL=%s", snapshotDeleteURL),
}
- if cr.AcceptEULA {
+ if vmBackup.AcceptEULA {
args = append(args, "-eula")
}
- if cr.LogLevel != nil {
- args = append(args, fmt.Sprintf("-loggerLevel=%s", *cr.LogLevel))
+ if vmBackup.LogLevel != nil {
+ args = append(args, fmt.Sprintf("-loggerLevel=%s", *vmBackup.LogLevel))
}
- if cr.LogFormat != nil {
- args = append(args, fmt.Sprintf("-loggerFormat=%s", *cr.LogFormat))
+ if vmBackup.LogFormat != nil {
+ args = append(args, fmt.Sprintf("-loggerFormat=%s", *vmBackup.LogFormat))
}
- for key, value := range cr.ExtraArgs {
+ for key, value := range vmBackup.ExtraArgs {
arg := fmt.Sprintf("-%s", key)
if len(value) != 0 {
arg = fmt.Sprintf("%s=%s", arg, value)
}
args = append(args, arg)
}
- if cr.Concurrency != nil {
- args = append(args, fmt.Sprintf("-concurrency=%d", *cr.Concurrency))
+ if vmBackup.Concurrency != nil {
+ args = append(args, fmt.Sprintf("-concurrency=%d", *vmBackup.Concurrency))
}
- if cr.CustomS3Endpoint != nil {
- args = append(args, fmt.Sprintf("-customS3Endpoint=%s", *cr.CustomS3Endpoint))
+ if vmBackup.CustomS3Endpoint != nil {
+ args = append(args, fmt.Sprintf("-customS3Endpoint=%s", *vmBackup.CustomS3Endpoint))
}
- if cr.DisableHourly != nil && *cr.DisableHourly {
+ if vmBackup.DisableHourly != nil && *vmBackup.DisableHourly {
args = append(args, "-disableHourly")
}
- if cr.DisableDaily != nil && *cr.DisableDaily {
+ if vmBackup.DisableDaily != nil && *vmBackup.DisableDaily {
args = append(args, "-disableDaily")
}
- if cr.DisableMonthly != nil && *cr.DisableMonthly {
+ if vmBackup.DisableMonthly != nil && *vmBackup.DisableMonthly {
args = append(args, "-disableMonthly")
}
- if cr.DisableWeekly != nil && *cr.DisableWeekly {
+ if vmBackup.DisableWeekly != nil && *vmBackup.DisableWeekly {
args = append(args, "-disableWeekly")
}
@@ -95,22 +104,22 @@ func VMBackupManager(
if config.UseOldBackupRestorePortNames() {
portName = "http"
}
- ports = append(ports, corev1.ContainerPort{Name: portName, Protocol: "TCP", ContainerPort: intstr.Parse(cr.Port).IntVal})
- mounts = append(mounts, cr.VolumeMounts...)
- if cr.CredentialsSecret != nil {
+ ports = append(ports, corev1.ContainerPort{Name: portName, Protocol: "TCP", ContainerPort: intstr.Parse(vmBackup.Port).IntVal})
+ mounts = append(mounts, vmBackup.VolumeMounts...)
+ if vmBackup.CredentialsSecret != nil {
mounts = append(mounts, corev1.VolumeMount{
- Name: k8stools.SanitizeVolumeName("secret-" + cr.CredentialsSecret.Name),
+ Name: k8stools.SanitizeVolumeName("secret-" + vmBackup.CredentialsSecret.Name),
MountPath: vmBackuperCreds,
ReadOnly: true,
})
- args = append(args, fmt.Sprintf("-credsFilePath=%s/%s", vmBackuperCreds, cr.CredentialsSecret.Key))
+ args = append(args, fmt.Sprintf("-credsFilePath=%s/%s", vmBackuperCreds, vmBackup.CredentialsSecret.Key))
}
_, mounts = LicenseVolumeTo(nil, mounts, license, vmv1beta1.SecretsDir)
args = LicenseArgsTo(args, license, vmv1beta1.SecretsDir)
- extraEnvs := cr.ExtraEnvs
- if len(cr.ExtraEnvs) > 0 || len(cr.ExtraEnvsFrom) > 0 {
+ extraEnvs := vmBackup.ExtraEnvs
+ if len(vmBackup.ExtraEnvs) > 0 || len(vmBackup.ExtraEnvsFrom) > 0 {
args = append(args, "-envflag.enable=true")
}
// expose POD_NAME information by default
@@ -126,14 +135,14 @@ func VMBackupManager(
livenessProbeHandler := corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
- Port: intstr.Parse(cr.Port),
+ Port: intstr.Parse(vmBackup.Port),
Scheme: "HTTP",
Path: "/health",
},
}
readinessProbeHandler := corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
- Port: intstr.Parse(cr.Port),
+ Port: intstr.Parse(vmBackup.Port),
Scheme: "HTTP",
Path: "/health",
},
@@ -157,14 +166,14 @@ func VMBackupManager(
sort.Strings(args)
vmBackuper := &corev1.Container{
Name: "vmbackuper",
- Image: cr.Image.Reference(),
+ Image: vmBackup.Image.Reference(),
Ports: ports,
Args: args,
Env: extraEnvs,
VolumeMounts: mounts,
LivenessProbe: livenessProbe,
ReadinessProbe: readinessProbe,
- Resources: cr.Resources,
+ Resources: vmBackup.Resources,
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
}
return vmBackuper, nil
diff --git a/internal/controller/operator/factory/build/build_test.go b/internal/controller/operator/factory/build/build_test.go
index 1241c7a7d2..ecc0ed42f3 100644
--- a/internal/controller/operator/factory/build/build_test.go
+++ b/internal/controller/operator/factory/build/build_test.go
@@ -225,15 +225,19 @@ func TestDeepMerge(t *testing.T) {
ServiceAccountName: "base",
RetentionPeriod: "30d",
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- ExtraArgs: map[string]string{"keep": "x", "override": "old"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ ExtraArgs: map[string]string{"keep": "x", "override": "old"},
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- ExtraArgs: map[string]string{"insert-arg": "1"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ ExtraArgs: map[string]string{"insert-arg": "1"},
+ },
},
},
}
@@ -248,9 +252,11 @@ func TestDeepMerge(t *testing.T) {
override: &vmv1beta1.VMClusterSpec{
ClusterVersion: "v1.2.3",
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(3)),
- ExtraArgs: map[string]string{"override": "new", "add": "y"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(3)),
+ ExtraArgs: map[string]string{"override": "new", "add": "y"},
+ },
},
},
ServiceAccountName: "zone-sa",
diff --git a/internal/controller/operator/factory/build/cluster.go b/internal/controller/operator/factory/build/cluster.go
deleted file mode 100644
index 76e917979b..0000000000
--- a/internal/controller/operator/factory/build/cluster.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package build
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "sigs.k8s.io/controller-runtime/pkg/client"
-
- vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
-)
-
-type ParentOpts interface {
- client.Object
- PrefixedInternalName(vmv1beta1.ClusterComponent) string
- PrefixedName(vmv1beta1.ClusterComponent) string
- SelectorLabels(vmv1beta1.ClusterComponent) map[string]string
- GetServiceAccountName() string
- GetAdditionalService(vmv1beta1.ClusterComponent) *vmv1beta1.AdditionalServiceSpec
- IsOwnsServiceAccount() bool
- FinalAnnotations() map[string]string
- FinalLabels(vmv1beta1.ClusterComponent) map[string]string
- AsOwner() metav1.OwnerReference
-}
-
-type ChildBuilder struct {
- ParentOpts
- kind vmv1beta1.ClusterComponent
- finalLabels map[string]string
- selectorLabels map[string]string
-}
-
-// PrefixedName implements build.svcBuilderArgs interface
-func (b *ChildBuilder) PrefixedName() string {
- return b.ParentOpts.PrefixedName(b.kind)
-}
-
-// FinalLabels implements build.svcBuilderArgs interface
-func (b *ChildBuilder) FinalLabels() map[string]string {
- return b.finalLabels
-}
-
-// SelectorLabels implements build.svcBuilderArgs interface
-func (b *ChildBuilder) SelectorLabels() map[string]string {
- return b.selectorLabels
-}
-
-// GetAdditionalService implements build.svcBuilderArgs interface
-func (b *ChildBuilder) GetAdditionalService() *vmv1beta1.AdditionalServiceSpec {
- return b.ParentOpts.GetAdditionalService(b.kind)
-}
-
-func (b *ChildBuilder) SetFinalLabels(ls map[string]string) {
- b.finalLabels = ls
-}
-
-func (b *ChildBuilder) SetSelectorLabels(ls map[string]string) {
- b.selectorLabels = ls
-}
-
-func NewChildBuilder(cr ParentOpts, kind vmv1beta1.ClusterComponent) *ChildBuilder {
- return &ChildBuilder{
- ParentOpts: cr,
- kind: kind,
- finalLabels: cr.FinalLabels(kind),
- selectorLabels: cr.SelectorLabels(kind),
- }
-}
diff --git a/internal/controller/operator/factory/build/container.go b/internal/controller/operator/factory/build/container.go
index c918a2a399..1baeef7b9a 100644
--- a/internal/controller/operator/factory/build/container.go
+++ b/internal/controller/operator/factory/build/container.go
@@ -2,14 +2,15 @@ package build
import (
"fmt"
+ "net"
"path/filepath"
"sort"
+ "strconv"
"strings"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/intstr"
- "k8s.io/utils/ptr"
vmv1 "github.com/VictoriaMetrics/operator/api/operator/v1"
vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
@@ -22,17 +23,25 @@ const DataVolumeName = "data"
type probeCRD interface {
ProbePath() string
- ProbeScheme() string
- ProbePort() string
ProbeNeedLiveness() bool
- UseProxyProtocol() bool
+ Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams
+}
+
+// probeCRDWithNamedPort is implemented by CRs whose probe addresses the port by name.
+type probeCRDWithNamedPort interface {
+ ProbePort() intstr.IntOrString
}
// Probe adds probe for container
func Probe(container *corev1.Container, cr probeCRD, params *vmv1beta1.CommonAppsParams) {
- port := intstr.Parse(cr.ProbePort())
- scheme := cr.ProbeScheme()
+ appsParams := cr.Params(vmv1beta1.ScrapeParamsKind)
+ port := appsParams.ProbePort()
+ if override, ok := cr.(probeCRDWithNamedPort); ok {
+ port = override.ProbePort()
+ }
+ scheme := appsParams.ProbeScheme()
path := cr.ProbePath()
+ needsTCPFallback := appsParams.ProbeListener() == nil
getProbe := func(probe *corev1.Probe, createIfNil bool, forceTCP bool) *corev1.Probe {
if probe == nil {
if createIfNil {
@@ -42,7 +51,7 @@ func Probe(container *corev1.Container, cr probeCRD, params *vmv1beta1.CommonApp
}
}
if probe.HTTPGet == nil && probe.TCPSocket == nil && probe.Exec == nil {
- if forceTCP || cr.UseProxyProtocol() {
+ if forceTCP || needsTCPFallback {
probe.TCPSocket = new(corev1.TCPSocketAction)
} else {
probe.HTTPGet = new(corev1.HTTPGetAction)
@@ -341,44 +350,31 @@ var configReloaderContainerProbe = corev1.ProbeHandler{
},
}
-func configReloaderJobRelabeling() vmv1beta1.EndpointRelabelings {
- return vmv1beta1.EndpointRelabelings{
- RelabelConfigs: []*vmv1beta1.RelabelConfig{
- {
- SourceLabels: []string{"job"},
- TargetLabel: "job",
- Regex: vmv1beta1.StringOrArray{"(.+)"},
- Replacement: ptr.To("${1}-" + ConfigReloaderPortName),
- },
- },
- }
+type configReloaderScrapeBuilder struct{}
+
+// GetServiceScrape implements ScrapeBuilder interface
+func (configReloaderScrapeBuilder) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
+ return nil
}
-// ConfigReloaderVMServiceScrapeEndpoint returns a VMServiceScrape endpoint that scrapes the
-// config-reloader sidecar directly by its container port (via TargetPort, resolved from the
-// pod's actual EndpointSlice ports), without requiring a matching named ServicePort.
-func ConfigReloaderVMServiceScrapeEndpoint() vmv1beta1.Endpoint {
- return vmv1beta1.Endpoint{
- TargetPort: ptr.To(intstr.FromInt32(ConfigReloaderDefaultPort)),
- EndpointRelabelings: configReloaderJobRelabeling(),
- EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
- Path: "/metrics",
- },
- }
+// GetMetricsPath implements ScrapeBuilder interface
+func (configReloaderScrapeBuilder) GetMetricsPath() string {
+ return "/metrics"
}
-// ConfigReloaderPodScrapeEndpoint returns a VMPodScrape endpoint that scrapes the
-// config-reloader sidecar directly by its container port number.
-func ConfigReloaderPodScrapeEndpoint() vmv1beta1.PodMetricsEndpoint {
- return vmv1beta1.PodMetricsEndpoint{
- PortNumber: ptr.To(int32(ConfigReloaderDefaultPort)),
- EndpointRelabelings: configReloaderJobRelabeling(),
- EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
- Path: "/metrics",
- },
+// Params implements ScrapeBuilder interface
+func (configReloaderScrapeBuilder) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &vmv1beta1.StandardAppsParams{
+ HTTPListeners: []vmv1beta1.HTTPListener{{
+ Name: ConfigReloaderPortName,
+ Addr: fmt.Sprintf(":%d", ConfigReloaderDefaultPort),
+ }},
}
}
+// ConfigReloaderScrapeBuilder is the ScrapeBuilder for the config-reloader sidecar.
+var ConfigReloaderScrapeBuilder ScrapeBuilder = configReloaderScrapeBuilder{}
+
type reloadable interface {
GetReloaderParams() *vmv1beta1.CommonConfigReloaderParams
GetReloadURL(string) string
@@ -572,7 +568,7 @@ func AddSyslogPortsTo(dst []corev1.ContainerPort, syslogSpec *vmv1.SyslogServerS
}
// AddSyslogArgsTo adds syslog flag args into provided dst
-func AddSyslogArgsTo(dst []string, syslogSpec *vmv1.SyslogServerSpec, tlsServerConfigMountPath string) []string {
+func AddSyslogArgsTo(dst []string, syslogSpec *vmv1.SyslogServerSpec, tlsMountPath string) []string {
if syslogSpec == nil {
return dst
}
@@ -606,7 +602,7 @@ func AddSyslogArgsTo(dst []string, syslogSpec *vmv1.SyslogServerSpec, tlsServerC
case tlsC.CertFile != "":
value = tlsC.CertFile
case tlsC.CertSecret != nil:
- value = fmt.Sprintf("%s/%s/%s", tlsServerConfigMountPath, tlsC.CertSecret.Name, tlsC.CertSecret.Key)
+ value = fmt.Sprintf("%s/%s/%s", tlsMountPath, tlsC.CertSecret.Name, tlsC.CertSecret.Key)
}
tlsCertFile.Add(value, idx)
value = ""
@@ -614,7 +610,7 @@ func AddSyslogArgsTo(dst []string, syslogSpec *vmv1.SyslogServerSpec, tlsServerC
case tlsC.KeyFile != "":
value = tlsC.KeyFile
case tlsC.KeySecret != nil:
- value = fmt.Sprintf("%s/%s/%s", tlsServerConfigMountPath, tlsC.KeySecret.Name, tlsC.KeySecret.Key)
+ value = fmt.Sprintf("%s/%s/%s", tlsMountPath, tlsC.KeySecret.Name, tlsC.KeySecret.Key)
}
tlsKeyFile.Add(value, idx)
if len(tlsC.CipherSuites) > 0 {
@@ -655,39 +651,35 @@ func AddSyslogArgsTo(dst []string, syslogSpec *vmv1.SyslogServerSpec, tlsServerC
return dst
}
+// addTLSSecretVolume adds a secret volume+mount for sr, deduped by secret name across callers.
+func addTLSSecretVolume(dstVolumes []corev1.Volume, dstMounts []corev1.VolumeMount, sr *corev1.SecretKeySelector, tlsMountPath string) ([]corev1.Volume, []corev1.VolumeMount) {
+ name := k8stools.SanitizeVolumeName(vmv1beta1.TLSSecretVolumeNamePrefix + sr.Name)
+ for _, dst := range dstVolumes {
+ if dst.Name == name && dst.Secret != nil && dst.Secret.SecretName == sr.Name {
+ return dstVolumes, dstMounts
+ }
+ }
+ dstVolumes = append(dstVolumes, corev1.Volume{
+ Name: name,
+ VolumeSource: corev1.VolumeSource{
+ Secret: &corev1.SecretVolumeSource{SecretName: sr.Name},
+ },
+ })
+ dstMounts = append(dstMounts, corev1.VolumeMount{
+ Name: name,
+ MountPath: fmt.Sprintf("%s/%s", tlsMountPath, sr.Name),
+ })
+ return dstVolumes, dstMounts
+}
+
// AddSyslogTLSConfigToVolumes adds syslog tlsConfig volumes and mounts to the provided dsts
-func AddSyslogTLSConfigToVolumes(dstVolumes []corev1.Volume, dstMounts []corev1.VolumeMount, syslogSpec *vmv1.SyslogServerSpec, tlsServerConfigMountPath string) ([]corev1.Volume, []corev1.VolumeMount) {
+func AddSyslogTLSConfigToVolumes(dstVolumes []corev1.Volume, dstMounts []corev1.VolumeMount, syslogSpec *vmv1.SyslogServerSpec, tlsMountPath string) ([]corev1.Volume, []corev1.VolumeMount) {
if syslogSpec == nil || len(syslogSpec.TCPListeners) == 0 {
return dstVolumes, dstMounts
}
- addSecretVolume := func(sr *corev1.SecretKeySelector) {
- name := fmt.Sprintf("secret-tls-%s", sr.Name)
- for _, dst := range dstVolumes {
- if dst.Name == name {
- return
- }
- }
- dstVolumes = append(dstVolumes, corev1.Volume{
- Name: name,
- VolumeSource: corev1.VolumeSource{
- Secret: &corev1.SecretVolumeSource{
- SecretName: sr.Name,
- },
- },
- })
- }
- addSecretMount := func(sr *corev1.SecretKeySelector) {
- name := fmt.Sprintf("secret-tls-%s", sr.Name)
- for _, dst := range dstMounts {
- if dst.Name == name {
- return
- }
- }
- dstMounts = append(dstMounts, corev1.VolumeMount{
- Name: name,
- MountPath: fmt.Sprintf("%s/%s", tlsServerConfigMountPath, sr.Name),
- })
+ addSecret := func(sr *corev1.SecretKeySelector) {
+ dstVolumes, dstMounts = addTLSSecretVolume(dstVolumes, dstMounts, sr, tlsMountPath)
}
for _, tc := range syslogSpec.TCPListeners {
if tc.TLSConfig == nil {
@@ -697,15 +689,13 @@ func AddSyslogTLSConfigToVolumes(dstVolumes []corev1.Volume, dstMounts []corev1.
switch {
case tlsC.CertFile != "":
case tlsC.CertSecret != nil:
- addSecretVolume(tlsC.CertSecret)
- addSecretMount(tlsC.CertSecret)
+ addSecret(tlsC.CertSecret)
}
switch {
case tlsC.KeyFile != "":
case tlsC.KeySecret != nil:
- addSecretVolume(tlsC.KeySecret)
- addSecretMount(tlsC.KeySecret)
+ addSecret(tlsC.KeySecret)
}
}
@@ -718,14 +708,14 @@ func AddOTLPGRPCPortTo(dst []corev1.ContainerPort, grpcSpec *vmv1.OTLPGRPCSpec)
return dst
}
return append(dst, corev1.ContainerPort{
- Name: "otlp-grpc",
+ Name: vmv1.OTLPGRPCPortName,
Protocol: corev1.ProtocolTCP,
ContainerPort: grpcSpec.ListenPort,
})
}
// AddOTLPGRPCArgsTo adds otlpGRPC flag args into provided dst
-func AddOTLPGRPCArgsTo(dst []string, grpcSpec *vmv1.OTLPGRPCSpec, tlsServerConfigMountPath string) []string {
+func AddOTLPGRPCArgsTo(dst []string, grpcSpec *vmv1.OTLPGRPCSpec, tlsMountPath string) []string {
if grpcSpec == nil {
return dst
}
@@ -740,13 +730,13 @@ func AddOTLPGRPCArgsTo(dst []string, grpcSpec *vmv1.OTLPGRPCSpec, tlsServerConfi
case tlsC.CertFile != "":
dst = append(dst, fmt.Sprintf("-otlpGRPC.tlsCertFile=%s", tlsC.CertFile))
case tlsC.CertSecret != nil:
- dst = append(dst, fmt.Sprintf("-otlpGRPC.tlsCertFile=%s/%s/%s", tlsServerConfigMountPath, tlsC.CertSecret.Name, tlsC.CertSecret.Key))
+ dst = append(dst, fmt.Sprintf("-otlpGRPC.tlsCertFile=%s/%s/%s", tlsMountPath, tlsC.CertSecret.Name, tlsC.CertSecret.Key))
}
switch {
case tlsC.KeyFile != "":
dst = append(dst, fmt.Sprintf("-otlpGRPC.tlsKeyFile=%s", tlsC.KeyFile))
case tlsC.KeySecret != nil:
- dst = append(dst, fmt.Sprintf("-otlpGRPC.tlsKeyFile=%s/%s/%s", tlsServerConfigMountPath, tlsC.KeySecret.Name, tlsC.KeySecret.Key))
+ dst = append(dst, fmt.Sprintf("-otlpGRPC.tlsKeyFile=%s/%s/%s", tlsMountPath, tlsC.KeySecret.Name, tlsC.KeySecret.Key))
}
if tlsC.MinVersion != "" {
dst = append(dst, fmt.Sprintf("-otlpGRPC.tlsMinVersion=%s", tlsC.MinVersion))
@@ -757,49 +747,108 @@ func AddOTLPGRPCArgsTo(dst []string, grpcSpec *vmv1.OTLPGRPCSpec, tlsServerConfi
return dst
}
-// AddOTLPGRPCTLSConfigToVolumes adds OTLP gRPC tlsConfig volumes and mounts to the provided dsts
-func AddOTLPGRPCTLSConfigToVolumes(dstVolumes []corev1.Volume, dstMounts []corev1.VolumeMount, grpcSpec *vmv1.OTLPGRPCSpec, tlsServerConfigMountPath string) ([]corev1.Volume, []corev1.VolumeMount) {
- if grpcSpec == nil || grpcSpec.TLSConfig == nil {
- return dstVolumes, dstMounts
+// AddHTTPListenerArgsTo adds httpListenAddr and related positional flags from HTTPListeners into dst.
+// It should only be called when ExtraArgs["httpListenAddr"] is not set.
+func AddHTTPListenerArgsTo(dst []string, listeners []vmv1beta1.HTTPListener, tlsMountPath string) []string {
+ if len(listeners) == 0 {
+ return dst
}
+ listenAddr := NewEmptyFlag("-httpListenAddr")
+ tls := NewEmptyFlag("-tls")
+ tlsCertFile := NewEmptyFlag("-tlsCertFile")
+ tlsKeyFile := NewEmptyFlag("-tlsKeyFile")
+ tlsMinVersion := NewEmptyFlag("-tlsMinVersion")
+ autocertHosts := NewEmptyFlag("-tlsAutocertHosts")
+ autocertEmail := NewEmptyFlag("-tlsAutocertEmail")
+ autocertDir := NewEmptyFlag("-tlsAutocertCacheDir")
+ mtls := NewEmptyFlag("-mtls")
+ mtlsCAFile := NewEmptyFlag("-mtlsCAFile")
+ proxyProto := NewEmptyFlag("-httpListenAddr.useProxyProtocol")
+
+ for idx, hl := range listeners {
+ listenAddr.Add(hl.Addr, idx)
+ if hl.TLS != nil {
+ tls.Add(strconv.FormatBool(*hl.TLS), idx)
+ }
+ cert := hl.TLSCertFile
+ if cert == "" && hl.TLSCertSecret != nil {
+ cert = fmt.Sprintf("%s/%s/%s", tlsMountPath, hl.TLSCertSecret.Name, hl.TLSCertSecret.Key)
+ }
+ tlsCertFile.Add(cert, idx)
+ key := hl.TLSKeyFile
+ if key == "" && hl.TLSKeySecret != nil {
+ key = fmt.Sprintf("%s/%s/%s", tlsMountPath, hl.TLSKeySecret.Name, hl.TLSKeySecret.Key)
+ }
+ tlsKeyFile.Add(key, idx)
+ tlsMinVersion.Add(hl.TLSMinVersion, idx)
+ autocertHosts.Add(hl.TLSAutocertHosts, idx)
+ autocertEmail.Add(hl.TLSAutocertEmail, idx)
+ autocertDir.Add(hl.TLSAutocertCacheDir, idx)
+ if hl.MTLS != nil {
+ mtls.Add(strconv.FormatBool(*hl.MTLS), idx)
+ }
+ ca := hl.MTLSCAFile
+ if ca == "" && hl.MTLSCASecret != nil {
+ ca = fmt.Sprintf("%s/%s/%s", tlsMountPath, hl.MTLSCASecret.Name, hl.MTLSCASecret.Key)
+ }
+ mtlsCAFile.Add(ca, idx)
+ if hl.UseProxyProtocol != nil {
+ proxyProto.Add(strconv.FormatBool(*hl.UseProxyProtocol), idx)
+ }
+ }
+ return AppendFlagsToArgs(dst, len(listeners),
+ listenAddr, tls, tlsCertFile, tlsKeyFile, tlsMinVersion,
+ autocertHosts, autocertEmail, autocertDir, mtls, mtlsCAFile, proxyProto)
+}
- addSecretVolume := func(sr *corev1.SecretKeySelector) {
- name := fmt.Sprintf("secret-tls-%s", sr.Name)
- for _, dst := range dstVolumes {
- if dst.Name == name {
- return
- }
+// AddHTTPListenerPortsTo appends container ports derived from HTTPListeners into dst.
+func AddHTTPListenerPortsTo(dst []corev1.ContainerPort, listeners []vmv1beta1.HTTPListener) []corev1.ContainerPort {
+ for _, hl := range listeners {
+ _, portStr, err := net.SplitHostPort(hl.Addr)
+ if err != nil {
+ continue
}
- dstVolumes = append(dstVolumes, corev1.Volume{
- Name: name,
- VolumeSource: corev1.VolumeSource{
- Secret: &corev1.SecretVolumeSource{
- SecretName: sr.Name,
- },
- },
- })
- }
- addSecretMount := func(sr *corev1.SecretKeySelector) {
- name := fmt.Sprintf("secret-tls-%s", sr.Name)
- for _, dst := range dstMounts {
- if dst.Name == name {
- return
- }
+ portInt, err := strconv.ParseInt(portStr, 10, 32)
+ if err != nil {
+ continue
}
- dstMounts = append(dstMounts, corev1.VolumeMount{
- Name: name,
- MountPath: fmt.Sprintf("%s/%s", tlsServerConfigMountPath, sr.Name),
+ dst = append(dst, corev1.ContainerPort{
+ Name: hl.Name,
+ Protocol: corev1.ProtocolTCP,
+ ContainerPort: int32(portInt),
})
}
+ return dst
+}
+
+// AddOTLPGRPCTLSConfigToVolumes adds OTLP gRPC tlsConfig volumes and mounts to the provided dsts
+func AddOTLPGRPCTLSConfigToVolumes(dstVolumes []corev1.Volume, dstMounts []corev1.VolumeMount, grpcSpec *vmv1.OTLPGRPCSpec, tlsMountPath string) ([]corev1.Volume, []corev1.VolumeMount) {
+ if grpcSpec == nil || grpcSpec.TLSConfig == nil {
+ return dstVolumes, dstMounts
+ }
tlsC := grpcSpec.TLSConfig
if tlsC.CertSecret != nil {
- addSecretVolume(tlsC.CertSecret)
- addSecretMount(tlsC.CertSecret)
+ dstVolumes, dstMounts = addTLSSecretVolume(dstVolumes, dstMounts, tlsC.CertSecret, tlsMountPath)
}
if tlsC.KeySecret != nil {
- addSecretVolume(tlsC.KeySecret)
- addSecretMount(tlsC.KeySecret)
+ dstVolumes, dstMounts = addTLSSecretVolume(dstVolumes, dstMounts, tlsC.KeySecret, tlsMountPath)
+ }
+ return dstVolumes, dstMounts
+}
+
+// AddHTTPListenerTLSToVolumes mounts secret volumes for any TLS secrets referenced by HTTPListeners.
+func AddHTTPListenerTLSToVolumes(dstVolumes []corev1.Volume, dstMounts []corev1.VolumeMount, listeners []vmv1beta1.HTTPListener, tlsMountPath string) ([]corev1.Volume, []corev1.VolumeMount) {
+ for _, hl := range listeners {
+ if hl.TLSCertSecret != nil {
+ dstVolumes, dstMounts = addTLSSecretVolume(dstVolumes, dstMounts, hl.TLSCertSecret, tlsMountPath)
+ }
+ if hl.TLSKeySecret != nil {
+ dstVolumes, dstMounts = addTLSSecretVolume(dstVolumes, dstMounts, hl.TLSKeySecret, tlsMountPath)
+ }
+ if hl.MTLSCASecret != nil {
+ dstVolumes, dstMounts = addTLSSecretVolume(dstVolumes, dstMounts, hl.MTLSCASecret, tlsMountPath)
+ }
}
return dstVolumes, dstMounts
}
diff --git a/internal/controller/operator/factory/build/container_test.go b/internal/controller/operator/factory/build/container_test.go
index 8c890b0048..17203d5f10 100644
--- a/internal/controller/operator/factory/build/container_test.go
+++ b/internal/controller/operator/factory/build/container_test.go
@@ -30,20 +30,19 @@ func (t testBuildProbeCR) ProbePath() string {
return t.probePath
}
-func (t testBuildProbeCR) ProbeScheme() string {
- return t.scheme
-}
-
-func (t testBuildProbeCR) ProbePort() string {
- return t.port
-}
-
func (t testBuildProbeCR) ProbeNeedLiveness() bool {
return t.needAddLiveness
}
-func (t testBuildProbeCR) UseProxyProtocol() bool {
- return t.useProxyProtocol
+func (t testBuildProbeCR) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ return &vmv1beta1.StandardAppsParams{
+ HTTPListeners: []vmv1beta1.HTTPListener{{
+ Name: "http",
+ Addr: ":" + t.port,
+ TLS: ptr.To(t.scheme == "HTTPS"),
+ UseProxyProtocol: ptr.To(t.useProxyProtocol),
+ }},
+ }
}
func Test_buildProbe(t *testing.T) {
@@ -508,6 +507,35 @@ func TestAddOTLPGRPCTLSConfigToVolumes(t *testing.T) {
assert.Equal(t, "/etc/vt/tls-server-secrets/tls", mounts[0].MountPath)
}
+func TestAddTLSSecretVolume_SharedAcrossListenerKinds(t *testing.T) {
+ const tlsMountPath = "/etc/tls-secrets"
+ secretRef := &corev1.SecretKeySelector{
+ Key: "CERT",
+ LocalObjectReference: corev1.LocalObjectReference{Name: "shared"},
+ }
+
+ var volumes []corev1.Volume
+ var mounts []corev1.VolumeMount
+
+ listeners := []vmv1beta1.HTTPListener{{Name: "https", Addr: ":8443", TLSCertSecret: secretRef}}
+ volumes, mounts = AddHTTPListenerTLSToVolumes(volumes, mounts, listeners, tlsMountPath)
+
+ syslogSpec := &vmv1.SyslogServerSpec{
+ TCPListeners: []*vmv1.SyslogTCPListener{
+ {TLSConfig: &vmv1.TLSServerConfig{CertSecret: secretRef}},
+ },
+ }
+ volumes, mounts = AddSyslogTLSConfigToVolumes(volumes, mounts, syslogSpec, tlsMountPath)
+
+ grpcSpec := &vmv1.OTLPGRPCSpec{TLSConfig: &vmv1.TLSServerConfig{CertSecret: secretRef}}
+ volumes, mounts = AddOTLPGRPCTLSConfigToVolumes(volumes, mounts, grpcSpec, tlsMountPath)
+
+ require.Len(t, volumes, 1)
+ require.Len(t, mounts, 1)
+ assert.Equal(t, "shared", volumes[0].Secret.SecretName)
+ assert.Equal(t, tlsMountPath+"/shared", mounts[0].MountPath)
+}
+
func TestStorageVolumeMountsTo(t *testing.T) {
type opts struct {
pvcSrc *corev1.PersistentVolumeClaimVolumeSource
@@ -804,9 +832,11 @@ func TestBuildConfigReloaderContainer(t *testing.T) {
Name: "base",
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ExtraArgs: map[string]string{
- "reloadAuthKey": "test",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: map[string]string{
+ "reloadAuthKey": "test",
+ },
},
},
},
@@ -938,8 +968,10 @@ func TestBuildConfigReloaderContainer(t *testing.T) {
Name: "base",
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ConfigMaps: []string{"extra-template-1", "extra-template-2"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ConfigMaps: []string{"extra-template-1", "extra-template-2"},
+ },
},
},
},
diff --git a/internal/controller/operator/factory/build/defaults.go b/internal/controller/operator/factory/build/defaults.go
index 4e92a9ed35..7389c942bd 100644
--- a/internal/controller/operator/factory/build/defaults.go
+++ b/internal/controller/operator/factory/build/defaults.go
@@ -307,6 +307,7 @@ func addVMAuthDefaults(objI any) {
}
addDefaultsToCommonParams(&cr.Spec.CommonAppsParams, &cp, &cv)
addDefaultsToConfigReloader(&cr.Spec.CommonConfigReloaderParams, ptr.Deref(cr.Spec.UseDefaultResources, false))
+ addDefaultHTTPListeners(&cr.Spec.CommonAppsParams, cr.Spec.UseProxyProtocol, &cr.Spec.HTTPListeners)
}
func addVMAlertDefaults(objI any) {
@@ -325,6 +326,7 @@ func addVMAlertDefaults(objI any) {
if cr.Spec.ConfigReloaderImage == "" {
panic("cannot be empty")
}
+ addDefaultHTTPListeners(&cr.Spec.CommonAppsParams, false, &cr.Spec.HTTPListeners)
}
func addVMAgentDefaults(objI any) {
@@ -342,6 +344,7 @@ func addVMAgentDefaults(objI any) {
if cr.Spec.IngestOnlyMode == nil {
cr.Spec.IngestOnlyMode = ptr.To(false)
}
+ addDefaultHTTPListeners(&cr.Spec.CommonAppsParams, false, &cr.Spec.HTTPListeners)
}
func addVLAgentDefaults(objI any) {
@@ -355,6 +358,7 @@ func addVLAgentDefaults(objI any) {
license: cr.Spec.License,
}
addDefaultsToCommonParams(&cr.Spec.CommonAppsParams, &cp, &cv)
+ addDefaultHTTPListeners(&cr.Spec.CommonAppsParams, false, &cr.Spec.HTTPListeners)
}
func addVTAgentDefaults(objI any) {
@@ -364,6 +368,7 @@ func addVTAgentDefaults(objI any) {
cv := config.ApplicationDefaults(c.VTAgent)
cp := commonParams{tag: cr.Spec.ComponentVersion}
addDefaultsToCommonParams(&cr.Spec.CommonAppsParams, &cp, &cv)
+ addDefaultHTTPListeners(&cr.Spec.CommonAppsParams, false, &cr.Spec.HTTPListeners)
}
func addVMSingleDefaults(objI any) {
@@ -380,6 +385,7 @@ func addVMSingleDefaults(objI any) {
if cr.Spec.IngestOnlyMode == nil {
cr.Spec.IngestOnlyMode = ptr.To(true)
}
+ addDefaultHTTPListeners(&cr.Spec.CommonAppsParams, false, &cr.Spec.HTTPListeners)
bv := config.ApplicationDefaults(c.VMBackup)
useBackupDefaultResources := c.VMBackup.UseDefaultResources
if cr.Spec.UseDefaultResources != nil {
@@ -451,6 +457,7 @@ func addVLSingleDefaults(objI any) {
license: cr.Spec.License,
}
addDefaultsToCommonParams(&cr.Spec.CommonAppsParams, &cp, &cv)
+ addDefaultHTTPListeners(&cr.Spec.CommonAppsParams, false, &cr.Spec.HTTPListeners)
}
func addVTSingleDefaults(objI any) {
@@ -460,6 +467,7 @@ func addVTSingleDefaults(objI any) {
cv := config.ApplicationDefaults(c.VTSingle)
cp := commonParams{tag: cr.Spec.ComponentVersion}
addDefaultsToCommonParams(&cr.Spec.CommonAppsParams, &cp, &cv)
+ addDefaultHTTPListeners(&cr.Spec.CommonAppsParams, false, &cr.Spec.HTTPListeners)
}
func addVMAlertmanagerDefaults(objI any) {
@@ -529,6 +537,7 @@ func addVMClusterDefaults(objI any) {
cpStorage.tag = setTag(cr.Spec.VMStorage.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.VMStorage.CommonAppsParams, &cpStorage, &cv)
cr.Spec.VMStorage.PreStopSleepSeconds = nil
+ addDefaultHTTPListeners(&cr.Spec.VMStorage.CommonAppsParams, false, &cr.Spec.VMStorage.HTTPListeners)
bv := config.ApplicationDefaults(c.VMBackup)
useBackupDefaultResources := c.VMBackup.UseDefaultResources
@@ -542,6 +551,7 @@ func addVMClusterDefaults(objI any) {
cpInsert := cp
cpInsert.tag = setTag(cr.Spec.VMInsert.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.VMInsert.CommonAppsParams, &cpInsert, &cv)
+ addDefaultHTTPListeners(&cr.Spec.VMInsert.CommonAppsParams, false, &cr.Spec.VMInsert.HTTPListeners)
}
if cr.Spec.VMSelect != nil {
if cr.Spec.VMSelect.CacheMountPath == "" {
@@ -551,6 +561,7 @@ func addVMClusterDefaults(objI any) {
cpSelect := cp
cpSelect.tag = setTag(cr.Spec.VMSelect.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.VMSelect.CommonAppsParams, &cpSelect, &cv)
+ addDefaultHTTPListeners(&cr.Spec.VMSelect.CommonAppsParams, false, &cr.Spec.VMSelect.HTTPListeners)
}
if cr.Spec.RequestsLoadBalancer.Enabled {
cpLB := cp
@@ -711,6 +722,7 @@ func addVTClusterDefaults(objI any) {
cpStorage.tag = setTag(cr.Spec.Storage.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.Storage.CommonAppsParams, &cpStorage, &cv)
cr.Spec.Storage.PreStopSleepSeconds = nil
+ addDefaultHTTPListeners(&cr.Spec.Storage.CommonAppsParams, false, &cr.Spec.Storage.HTTPListeners)
}
if cr.Spec.Insert != nil {
@@ -718,6 +730,7 @@ func addVTClusterDefaults(objI any) {
cpInsert := cp
cpInsert.tag = setTag(cr.Spec.Insert.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.Insert.CommonAppsParams, &cpInsert, &cv)
+ addDefaultHTTPListeners(&cr.Spec.Insert.CommonAppsParams, false, &cr.Spec.Insert.HTTPListeners)
}
if cr.Spec.Select != nil {
@@ -725,6 +738,7 @@ func addVTClusterDefaults(objI any) {
cpSelect := cp
cpSelect.tag = setTag(cr.Spec.Select.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.Select.CommonAppsParams, &cpSelect, &cv)
+ addDefaultHTTPListeners(&cr.Spec.Select.CommonAppsParams, false, &cr.Spec.Select.HTTPListeners)
}
if cr.Spec.RequestsLoadBalancer.Enabled {
@@ -756,18 +770,21 @@ func addVLClusterDefaults(objI any) {
cpStorage.tag = setTag(cr.Spec.VLStorage.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.VLStorage.CommonAppsParams, &cpStorage, &cv)
cr.Spec.VLStorage.PreStopSleepSeconds = nil
+ addDefaultHTTPListeners(&cr.Spec.VLStorage.CommonAppsParams, false, &cr.Spec.VLStorage.HTTPListeners)
}
if cr.Spec.VLInsert != nil {
cv := config.ApplicationDefaults(c.VLCluster.Insert)
cpInsert := cp
cpInsert.tag = setTag(cr.Spec.VLInsert.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.VLInsert.CommonAppsParams, &cpInsert, &cv)
+ addDefaultHTTPListeners(&cr.Spec.VLInsert.CommonAppsParams, false, &cr.Spec.VLInsert.HTTPListeners)
}
if cr.Spec.VLSelect != nil {
cv := config.ApplicationDefaults(c.VLCluster.Select)
cpSelect := cp
cpSelect.tag = setTag(cr.Spec.VLSelect.ComponentVersion, cp.tag)
addDefaultsToCommonParams(&cr.Spec.VLSelect.CommonAppsParams, &cpSelect, &cv)
+ addDefaultHTTPListeners(&cr.Spec.VLSelect.CommonAppsParams, false, &cr.Spec.VLSelect.HTTPListeners)
}
if cr.Spec.RequestsLoadBalancer.Enabled {
cpLB := cp
@@ -806,3 +823,26 @@ func setTag(componentVersion, clusterVersion string) string {
}
return clusterVersion
}
+
+// addDefaultHTTPListeners populates a single default HTTPListener when the slice is empty,
+// honoring any legacy httpListenAddr override set via ExtraArgs, and migrates the deprecated UseProxyProtocol flag into the default listener.
+func addDefaultHTTPListeners(common *vmv1beta1.CommonAppsParams, useProxyProtocol bool, httpListeners *[]vmv1beta1.HTTPListener) {
+ if len(*httpListeners) > 0 {
+ if useProxyProtocol {
+ for i := range *httpListeners {
+ if (*httpListeners)[i].UseProxyProtocol == nil {
+ (*httpListeners)[i].UseProxyProtocol = ptr.To(true)
+ }
+ }
+ }
+ return
+ }
+ l := vmv1beta1.HTTPListener{Name: "http", Addr: ":" + common.Port}
+ if addr, hasOverride := vmv1beta1.FirstHTTPListenAddrOverride(common.ExtraArgs); hasOverride {
+ l.Addr = addr
+ }
+ if useProxyProtocol {
+ l.UseProxyProtocol = ptr.To(true)
+ }
+ *httpListeners = []vmv1beta1.HTTPListener{l}
+}
diff --git a/internal/controller/operator/factory/build/defaults_test.go b/internal/controller/operator/factory/build/defaults_test.go
index cea3727a65..8726999858 100644
--- a/internal/controller/operator/factory/build/defaults_test.go
+++ b/internal/controller/operator/factory/build/defaults_test.go
@@ -260,9 +260,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
VMSelect: &vmv1beta1.VMSelect{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
@@ -277,9 +279,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
Select: &vmv1.VTSelect{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
@@ -294,9 +298,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
VLSelect: &vmv1.VLSelect{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
@@ -311,9 +317,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
VMInsert: &vmv1beta1.VMInsert{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
@@ -328,9 +336,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
VMStorage: &vmv1beta1.VMStorage{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
@@ -345,9 +355,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
Insert: &vmv1.VTInsert{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
@@ -362,9 +374,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
Storage: &vmv1.VTStorage{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
@@ -379,9 +393,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
VLInsert: &vmv1.VLInsert{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
@@ -396,9 +412,11 @@ func TestClusterComponentVersionDefaults(t *testing.T) {
ClusterVersion: o.clusterVersion,
VLStorage: &vmv1.VLStorage{
ComponentVersion: o.componentVersion,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: o.imageTag,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: o.imageTag,
+ },
},
},
},
diff --git a/internal/controller/operator/factory/build/service.go b/internal/controller/operator/factory/build/service.go
index e7fbab9421..3430c35b5e 100644
--- a/internal/controller/operator/factory/build/service.go
+++ b/internal/controller/operator/factory/build/service.go
@@ -2,6 +2,7 @@ package build
import (
"fmt"
+ "net"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -207,9 +208,34 @@ func AddOTLPGRPCPortToService(svc *corev1.Service, grpcSpec *vmv1.OTLPGRPCSpec)
return
}
svc.Spec.Ports = append(svc.Spec.Ports, corev1.ServicePort{
- Name: "otlp-grpc",
+ Name: vmv1.OTLPGRPCPortName,
Protocol: corev1.ProtocolTCP,
Port: grpcSpec.ListenPort,
TargetPort: intstr.FromInt32(grpcSpec.ListenPort),
})
}
+
+// AddHTTPListenerPortsToService replaces the default "http" service port with ports
+// derived from listeners. No-op when listeners is empty (preserves existing "http" port).
+func AddHTTPListenerPortsToService(svc *corev1.Service, listeners []vmv1beta1.HTTPListener) {
+ if len(listeners) == 0 {
+ return
+ }
+ filtered := svc.Spec.Ports[:0]
+ for _, p := range svc.Spec.Ports {
+ if p.Name != "http" {
+ filtered = append(filtered, p)
+ }
+ }
+ svc.Spec.Ports = filtered
+ for _, hl := range listeners {
+ _, portStr, _ := net.SplitHostPort(hl.Addr)
+ port := intstr.Parse(portStr)
+ svc.Spec.Ports = append(svc.Spec.Ports, corev1.ServicePort{
+ Name: hl.Name,
+ Protocol: corev1.ProtocolTCP,
+ Port: port.IntVal,
+ TargetPort: port,
+ })
+ }
+}
diff --git a/internal/controller/operator/factory/build/vmscrape.go b/internal/controller/operator/factory/build/vmscrape.go
index 39d83db92c..bc85953846 100644
--- a/internal/controller/operator/factory/build/vmscrape.go
+++ b/internal/controller/operator/factory/build/vmscrape.go
@@ -3,93 +3,88 @@ package build
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/ptr"
vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
)
-type scrapeBuilder interface {
+// ScrapeBuilder is implemented by primary CRs and by sidecars (vmbackupmanager, config-reloader, ...).
+type ScrapeBuilder interface {
GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec
- GetExtraArgs() map[string]string
GetMetricsPath() string
- UseTLS() bool
+ Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams
}
type podScrapeBuilder interface {
- scrapeBuilder
+ ScrapeBuilder
GetNamespace() string
PrefixedName() string
SelectorLabels() map[string]string
AsOwner() metav1.OwnerReference
}
-// VMServiceScrape creates corresponding object with `http` port endpoint obtained from given service
-// add additionalPortNames to the monitoring if needed
-func VMServiceScrape(service *corev1.Service, b scrapeBuilder, additionalPortNames ...string) *vmv1beta1.VMServiceScrape {
- var endpoints []vmv1beta1.Endpoint
-
- extraArgs := b.GetExtraArgs()
- authKey := extraArgs["metricsAuthKey"]
+// sidecarRelabelings builds the job-suffixing relabeling rule for a sidecar endpoint.
+func sidecarRelabelings(portName string) vmv1beta1.EndpointRelabelings {
+ return vmv1beta1.EndpointRelabelings{
+ RelabelConfigs: []*vmv1beta1.RelabelConfig{
+ {
+ SourceLabels: []string{"job"},
+ TargetLabel: "job",
+ Regex: vmv1beta1.StringOrArray{"(.+)"},
+ Replacement: ptr.To("${1}-" + portName),
+ },
+ },
+ }
+}
- const defaultPortName = "http"
- for _, servicePort := range service.Spec.Ports {
- // fast path - filter all unmatched ports
- if servicePort.Name != defaultPortName && len(additionalPortNames) == 0 {
- continue
- }
+// scrapeEndpointTLS returns the Scheme/TLSConfig/Params fields for a scrape endpoint.
+func scrapeEndpointTLS(useTLS bool, authKey string) (scheme string, tlsConfig *vmv1beta1.TLSConfig, params map[string][]string) {
+ if useTLS {
+ scheme = "https"
+ tlsConfig = &vmv1beta1.TLSConfig{InsecureSkipVerify: true}
+ }
+ if len(authKey) > 0 {
+ params = map[string][]string{"authKey": {authKey}}
+ }
+ return
+}
- var extraRelabelingRules vmv1beta1.EndpointRelabelings
- path := b.GetMetricsPath()
- if servicePort.Name != defaultPortName {
- // check service for extra ports
- var nameMatched bool
- for _, filter := range additionalPortNames {
- if servicePort.Name == filter {
- nameMatched = true
- // sidecars (config-reloader, vmbackupmanager) always expose metrics at the
- // literal path below, regardless of the app's own http.pathPrefix
- path = "/metrics"
- // add a relabeling rule to avoid job collision
- extraRelabelingRules.RelabelConfigs = []*vmv1beta1.RelabelConfig{
- {
- SourceLabels: []string{"job"},
- TargetLabel: "job",
- Regex: vmv1beta1.StringOrArray{"(.+)"},
- Replacement: ptr.To("${1}-" + filter),
- },
- }
- break
- }
- }
- if !nameMatched {
- continue
+// VMServiceScrape builds a VMServiceScrape for service, scraping primary's own listeners plus
+// every sidecar's listeners, addressed by TargetPort.
+func VMServiceScrape(service *corev1.Service, primary ScrapeBuilder, sidecars ...ScrapeBuilder) *vmv1beta1.VMServiceScrape {
+ params := primary.Params(vmv1beta1.ScrapeParamsKind)
+ scrapeListeners := params.GetScrapeListeners()
+
+ authKey := params.ExtraArgs[vmv1beta1.MetricsAuthKeyFlag]
+ scrapeListenerTLS := func(name string) (bool, bool) {
+ for _, l := range scrapeListeners {
+ if l.Name == name {
+ return ptr.Deref(l.TLS, false), true
}
}
+ return false, false
+ }
- endpoint := vmv1beta1.Endpoint{
- Port: servicePort.Name,
- EndpointRelabelings: extraRelabelingRules,
+ var endpoints []vmv1beta1.Endpoint
+ for _, servicePort := range service.Spec.Ports {
+ useTLS, ok := scrapeListenerTLS(servicePort.Name)
+ if !ok {
+ continue
+ }
+ scheme, tlsConfig, epParams := scrapeEndpointTLS(useTLS, authKey)
+ endpoints = append(endpoints, vmv1beta1.Endpoint{
+ Port: servicePort.Name,
EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
- Path: path,
+ Path: primary.GetMetricsPath(),
+ Scheme: scheme,
+ Params: epParams,
+ EndpointAuth: vmv1beta1.EndpointAuth{TLSConfig: tlsConfig},
},
- }
- if b.UseTLS() {
- endpoint.Scheme = "https"
- // add insecure by default
- // if needed user will override it with direct config
- endpoint.TLSConfig = &vmv1beta1.TLSConfig{
- InsecureSkipVerify: true,
- }
- }
- if len(authKey) > 0 {
- endpoint.Params = map[string][]string{
- "authKey": {authKey},
- }
- }
- endpoints = append(endpoints, endpoint)
+ })
}
- serviceScrapeSpec := b.GetServiceScrape()
+ serviceScrapeSpec := primary.GetServiceScrape()
if serviceScrapeSpec == nil {
serviceScrapeSpec = &vmv1beta1.VMServiceScrapeSpec{}
}
@@ -103,8 +98,6 @@ func VMServiceScrape(service *corev1.Service, b scrapeBuilder, additionalPortNam
},
Spec: *serviceScrapeSpec,
}
- // merge generated endpoints into user defined values by Port name
- // assume, that it must be unique.
for _, e := range endpoints {
var found bool
for idx := range scrape.Spec.Endpoints {
@@ -120,9 +113,6 @@ func VMServiceScrape(service *corev1.Service, b scrapeBuilder, additionalPortNam
scrape.Spec.Endpoints = append(scrape.Spec.Endpoints, e)
}
}
- // allow to manually define selectors
- // in some cases it may be useful
- // for instance when additional service created with extra pod ports
if scrape.Spec.Selector.MatchLabels == nil && scrape.Spec.Selector.MatchExpressions == nil {
scrape.Spec.Selector = metav1.LabelSelector{
MatchLabels: service.Labels,
@@ -131,6 +121,28 @@ func VMServiceScrape(service *corev1.Service, b scrapeBuilder, additionalPortNam
},
}
}
+
+ for _, sidecar := range sidecars {
+ sidecarParams := sidecar.Params(vmv1beta1.ScrapeParamsKind)
+ sidecarAuthKey := sidecarParams.ExtraArgs[vmv1beta1.MetricsAuthKeyFlag]
+ for _, l := range sidecarParams.GetScrapeListeners() {
+ scheme, tlsConfig, epParams := scrapeEndpointTLS(ptr.Deref(l.TLS, false), sidecarAuthKey)
+ scrape.Spec.Endpoints = append(scrape.Spec.Endpoints, vmv1beta1.Endpoint{
+ TargetPort: ptr.To(intstr.Parse(l.AddrPort())),
+ EndpointRelabelings: sidecarRelabelings(l.Name),
+ EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
+ Path: sidecar.GetMetricsPath(),
+ Scheme: scheme,
+ Params: epParams,
+ EndpointAuth: vmv1beta1.EndpointAuth{TLSConfig: tlsConfig},
+ },
+ })
+ }
+ }
+
+ if len(scrape.Spec.Endpoints) == 0 {
+ return nil
+ }
for i := range scrape.Spec.Endpoints {
addVictoriaMetricsAppRelabelConfig(&scrape.Spec.Endpoints[i].EndpointRelabelings)
}
@@ -138,54 +150,25 @@ func VMServiceScrape(service *corev1.Service, b scrapeBuilder, additionalPortNam
return scrape
}
-// VMPodScrape builds a VMPodScrape for given podScrapeBuilder, with portName as the primary
-// endpoint and any additionalPortNames (e.g. sidecar metrics ports) appended alongside it.
-func VMPodScrape(b podScrapeBuilder, portName string, additionalPortNames ...string) *vmv1beta1.VMPodScrape {
- extraArgs := b.GetExtraArgs()
- authKey := extraArgs["metricsAuthKey"]
-
- buildEndpoint := func(name string, isPrimary bool) vmv1beta1.PodMetricsEndpoint {
- path := b.GetMetricsPath()
- var relabelings vmv1beta1.EndpointRelabelings
- if !isPrimary {
- // sidecars (e.g. config-reloader) always expose metrics at the literal path
- // below, regardless of the app's own http.pathPrefix
- path = "/metrics"
- relabelings.RelabelConfigs = []*vmv1beta1.RelabelConfig{
- {
- SourceLabels: []string{"job"},
- TargetLabel: "job",
- Regex: vmv1beta1.StringOrArray{"(.+)"},
- Replacement: ptr.To("${1}-" + name),
- },
- }
- }
- ep := vmv1beta1.PodMetricsEndpoint{
- Port: ptr.To(name),
- EndpointRelabelings: relabelings,
+// VMPodScrape builds a VMPodScrape for b, scraping its own listeners plus every sidecar's
+// listeners, addressed by PortNumber.
+func VMPodScrape(b podScrapeBuilder, sidecars ...ScrapeBuilder) *vmv1beta1.VMPodScrape {
+ params := b.Params(vmv1beta1.ScrapeParamsKind)
+ scrapeListeners := params.GetScrapeListeners()
+
+ authKey := params.ExtraArgs[vmv1beta1.MetricsAuthKeyFlag]
+ var endpoints []vmv1beta1.PodMetricsEndpoint
+ for _, l := range scrapeListeners {
+ scheme, tlsConfig, epParams := scrapeEndpointTLS(ptr.Deref(l.TLS, false), authKey)
+ endpoints = append(endpoints, vmv1beta1.PodMetricsEndpoint{
+ Port: ptr.To(l.Name),
EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
- Path: path,
+ Path: b.GetMetricsPath(),
+ Scheme: scheme,
+ Params: epParams,
+ EndpointAuth: vmv1beta1.EndpointAuth{TLSConfig: tlsConfig},
},
- }
- if b.UseTLS() {
- ep.Scheme = "https"
- // add insecure by default
- // if needed user will override it with direct config
- ep.TLSConfig = &vmv1beta1.TLSConfig{
- InsecureSkipVerify: true,
- }
- }
- if len(authKey) > 0 {
- ep.Params = map[string][]string{
- "authKey": {authKey},
- }
- }
- return ep
- }
-
- endpoints := []vmv1beta1.PodMetricsEndpoint{buildEndpoint(portName, true)}
- for _, name := range additionalPortNames {
- endpoints = append(endpoints, buildEndpoint(name, false))
+ })
}
selectorLabels := b.SelectorLabels()
@@ -227,6 +210,28 @@ func VMPodScrape(b podScrapeBuilder, portName string, additionalPortNames ...str
scrape.Spec.SeriesLimit = serviceScrapeSpec.SeriesLimit
scrape.Spec.AttachMetadata = serviceScrapeSpec.AttachMetadata
}
+
+ for _, sidecar := range sidecars {
+ sidecarParams := sidecar.Params(vmv1beta1.ScrapeParamsKind)
+ sidecarAuthKey := sidecarParams.ExtraArgs[vmv1beta1.MetricsAuthKeyFlag]
+ for _, l := range sidecarParams.GetScrapeListeners() {
+ scheme, tlsConfig, epParams := scrapeEndpointTLS(ptr.Deref(l.TLS, false), sidecarAuthKey)
+ scrape.Spec.PodMetricsEndpoints = append(scrape.Spec.PodMetricsEndpoints, vmv1beta1.PodMetricsEndpoint{
+ PortNumber: ptr.To(intstr.Parse(l.AddrPort()).IntVal),
+ EndpointRelabelings: sidecarRelabelings(l.Name),
+ EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
+ Path: sidecar.GetMetricsPath(),
+ Scheme: scheme,
+ Params: epParams,
+ EndpointAuth: vmv1beta1.EndpointAuth{TLSConfig: tlsConfig},
+ },
+ })
+ }
+ }
+
+ if len(scrape.Spec.PodMetricsEndpoints) == 0 {
+ return nil
+ }
for i := range scrape.Spec.PodMetricsEndpoints {
addVictoriaMetricsAppRelabelConfig(&scrape.Spec.PodMetricsEndpoints[i].EndpointRelabelings)
}
diff --git a/internal/controller/operator/factory/build/vmscrape_test.go b/internal/controller/operator/factory/build/vmscrape_test.go
index 8a3f6ab129..4fb6118656 100644
--- a/internal/controller/operator/factory/build/vmscrape_test.go
+++ b/internal/controller/operator/factory/build/vmscrape_test.go
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/ptr"
vmv1 "github.com/VictoriaMetrics/operator/api/operator/v1"
@@ -15,6 +16,15 @@ import (
type testScrapeObject struct {
serviceScrapeSpecTemplate *vmv1beta1.VMServiceScrapeSpec
extraArgs map[string]string
+ listeners []vmv1beta1.HTTPListener
+ primaryPortName string
+}
+
+func (tb *testScrapeObject) PrimaryPortName() string {
+ if tb.primaryPortName != "" {
+ return tb.primaryPortName
+ }
+ return "http"
}
func (tb *testScrapeObject) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
@@ -25,12 +35,17 @@ func (tb *testScrapeObject) GetMetricsPath() string {
return vmv1beta1.BuildPathWithPrefixFlag(tb.extraArgs, "/metrics")
}
-func (tb *testScrapeObject) UseTLS() bool {
- return vmv1beta1.UseTLS(tb.extraArgs)
-}
-
-func (tb *testScrapeObject) GetExtraArgs() map[string]string {
- return tb.extraArgs
+func (tb *testScrapeObject) Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams {
+ listeners := tb.listeners
+ if listeners == nil {
+ listeners = []vmv1beta1.HTTPListener{{Name: tb.PrimaryPortName()}}
+ }
+ return &vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: tb.extraArgs,
+ },
+ HTTPListeners: listeners,
+ }
}
func (tb *testScrapeObject) GetNamespace() string {
@@ -53,20 +68,23 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
vmAppRelabel := []*vmv1beta1.RelabelConfig{victoriaMetricsAppRelabelConfig()}
type opts struct {
spec testScrapeObject
+ sidecars []testScrapeObject
service *corev1.Service
- filterPortNames []string
wantServiceScrapeSpec vmv1beta1.VMServiceScrapeSpec
}
f := func(o opts) {
t.Helper()
- gotServiceScrape := VMServiceScrape(o.service, &o.spec, o.filterPortNames...)
+ sidecars := make([]ScrapeBuilder, len(o.sidecars))
+ for i := range o.sidecars {
+ sidecars[i] = &o.sidecars[i]
+ }
+ gotServiceScrape := VMServiceScrape(o.service, &o.spec, sidecars...)
assert.Equal(t, o.wantServiceScrapeSpec, gotServiceScrape.Spec)
}
// custom selector
f(opts{
- filterPortNames: []string{"http-2"},
service: &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "vmagent-svc",
@@ -101,9 +119,8 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
},
})
- // multiple ports with filter
+ // multiple ports, only the primary's own listener name matches
f(opts{
- filterPortNames: []string{"http-5"},
service: &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "vmagent-svc",
@@ -139,9 +156,12 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
},
})
- // multiple ports with vmbackup filter
+ // a sidecar (vmbackupmanager-style) contributes its own TargetPort-addressed endpoint,
+ // regardless of whether the Service happens to declare a matching named port
f(opts{
- filterPortNames: []string{"vmbackup"},
+ sidecars: []testScrapeObject{{
+ listeners: []vmv1beta1.HTTPListener{{Name: "vmbackup", Addr: ":9000"}},
+ }},
service: &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "vmagent-svc",
@@ -151,9 +171,6 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
{
Name: "http",
},
- {
- Name: "vmbackup",
- },
},
},
},
@@ -170,10 +187,10 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
Port: "http",
},
{
+ TargetPort: ptr.To(intstr.Parse("9000")),
EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
Path: "/metrics",
},
- Port: "vmbackup",
EndpointRelabelings: vmv1beta1.EndpointRelabelings{
RelabelConfigs: []*vmv1beta1.RelabelConfig{{
SourceLabels: []string{"job"},
@@ -308,11 +325,13 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
},
})
- // with a custom http.pathPrefix: the primary port uses it, but an additional (sidecar)
- // port always scrapes the literal /metrics path, since sidecars like config-reloader
- // are unaffected by the app's own path prefix
+ // with a custom http.pathPrefix: the primary port uses it, but a sidecar (config-reloader
+ // style) always scrapes its own literal /metrics path via TargetPort, unaffected by the
+ // app's own path prefix and needing no matching named Service port
f(opts{
- filterPortNames: []string{"reloader-http"},
+ sidecars: []testScrapeObject{{
+ listeners: []vmv1beta1.HTTPListener{{Name: "reloader-http", Addr: ":8435"}},
+ }},
service: &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "vmagent-svc",
@@ -320,7 +339,6 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
{Name: "http"},
- {Name: "reloader-http"},
},
},
},
@@ -339,10 +357,10 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
Port: "http",
},
{
+ TargetPort: ptr.To(intstr.Parse("8435")),
EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
Path: "/metrics",
},
- Port: "reloader-http",
EndpointRelabelings: vmv1beta1.EndpointRelabelings{
RelabelConfigs: []*vmv1beta1.RelabelConfig{{
SourceLabels: []string{"job"},
@@ -409,6 +427,62 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) {
},
},
})
+
+ // multiple HTTPListeners: every plain-HTTP one gets its own endpoint, a
+ // PROXY-protocol one is skipped, and a sidecar still contributes its own endpoint
+ f(opts{
+ sidecars: []testScrapeObject{{
+ listeners: []vmv1beta1.HTTPListener{{Name: "vmbackup", Addr: ":9000"}},
+ }},
+ service: &corev1.Service{
+ ObjectMeta: metav1.ObjectMeta{Name: "vmagent-svc"},
+ Spec: corev1.ServiceSpec{
+ Ports: []corev1.ServicePort{
+ {Name: "public"},
+ {Name: "internal"},
+ },
+ },
+ },
+ spec: testScrapeObject{
+ listeners: []vmv1beta1.HTTPListener{
+ {Name: "public", Addr: ":8427", Primary: true, UseProxyProtocol: ptr.To(true)},
+ {Name: "internal", Addr: ":8428"},
+ },
+ },
+ wantServiceScrapeSpec: vmv1beta1.VMServiceScrapeSpec{
+ Endpoints: []vmv1beta1.Endpoint{
+ {
+ EndpointRelabelings: vmv1beta1.EndpointRelabelings{
+ RelabelConfigs: vmAppRelabel,
+ },
+ EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
+ Path: "/metrics",
+ },
+ Port: "internal",
+ },
+ {
+ TargetPort: ptr.To(intstr.Parse("9000")),
+ EndpointScrapeParams: vmv1beta1.EndpointScrapeParams{
+ Path: "/metrics",
+ },
+ EndpointRelabelings: vmv1beta1.EndpointRelabelings{
+ RelabelConfigs: []*vmv1beta1.RelabelConfig{{
+ SourceLabels: []string{"job"},
+ TargetLabel: "job",
+ Regex: vmv1beta1.StringOrArray{"(.+)"},
+ Replacement: ptr.To("${1}-vmbackup"),
+ }, victoriaMetricsAppRelabelConfig()},
+ },
+ },
+ },
+ Selector: metav1.LabelSelector{
+ MatchExpressions: []metav1.LabelSelectorRequirement{{
+ Key: vmv1beta1.AdditionalServiceLabel,
+ Operator: metav1.LabelSelectorOpDoesNotExist,
+ }},
+ },
+ },
+ })
}
func TestVMServiceScrapeAddsVictoriaMetricsAppLabel(t *testing.T) {
@@ -416,7 +490,6 @@ func TestVMServiceScrapeAddsVictoriaMetricsAppLabel(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test"},
Spec: corev1.ServiceSpec{Ports: []corev1.ServicePort{
{Name: "http"},
- {Name: "extra"},
}},
}
spec := testScrapeObject{serviceScrapeSpecTemplate: &vmv1beta1.VMServiceScrapeSpec{
@@ -425,8 +498,9 @@ func TestVMServiceScrapeAddsVictoriaMetricsAppLabel(t *testing.T) {
{Port: "custom"},
},
}}
+ sidecar := testScrapeObject{listeners: []vmv1beta1.HTTPListener{{Name: "extra", Addr: ":1234"}}}
- scrape := VMServiceScrape(service, &spec, "extra")
+ scrape := VMServiceScrape(service, &spec, &sidecar)
assert.Len(t, scrape.Spec.Endpoints, 3)
for i := range scrape.Spec.Endpoints {
@@ -448,7 +522,7 @@ func TestVMPodScrapeAddsVictoriaMetricsAppLabel(t *testing.T) {
},
}}
- podScrape := VMPodScrape(&spec, "http")
+ podScrape := VMPodScrape(&spec)
assert.Len(t, podScrape.Spec.PodMetricsEndpoints, 2)
assert.Equal(t, "/custom", podScrape.Spec.PodMetricsEndpoints[0].Path)
@@ -457,32 +531,11 @@ func TestVMPodScrapeAddsVictoriaMetricsAppLabel(t *testing.T) {
}
}
-func TestVMPodScrapeAdditionalPorts(t *testing.T) {
- spec := testScrapeObject{extraArgs: map[string]string{"http.pathPrefix": "/prefix"}}
-
- scrape := VMPodScrape(&spec, "http", "reloader-http")
-
- assert.Len(t, scrape.Spec.PodMetricsEndpoints, 2)
- primary := scrape.Spec.PodMetricsEndpoints[0]
- assert.Equal(t, "http", *primary.Port)
- assert.Equal(t, "/prefix/metrics", primary.Path)
-
- extra := scrape.Spec.PodMetricsEndpoints[1]
- assert.Equal(t, "reloader-http", *extra.Port)
- // sidecar ports always scrape the literal /metrics path, unaffected by http.pathPrefix
- assert.Equal(t, "/metrics", extra.Path)
- assert.Contains(t, extra.RelabelConfigs, &vmv1beta1.RelabelConfig{
- SourceLabels: []string{"job"},
- TargetLabel: "job",
- Regex: vmv1beta1.StringOrArray{"(.+)"},
- Replacement: ptr.To("${1}-reloader-http"),
- })
-}
-
func TestVMServiceScrapeObjectsAddVictoriaMetricsAppLabel(t *testing.T) {
objectMeta := metav1.ObjectMeta{Name: "test", Namespace: "default"}
+ sap := vmv1beta1.StandardAppsParams{HTTPListeners: []vmv1beta1.HTTPListener{{Name: "http"}}}
- f := func(name string, builder scrapeBuilder) {
+ f := func(name string, builder ScrapeBuilder) {
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{Name: name},
Spec: corev1.ServiceSpec{Ports: []corev1.ServicePort{
@@ -495,32 +548,33 @@ func TestVMServiceScrapeObjectsAddVictoriaMetricsAppLabel(t *testing.T) {
assert.Len(t, scrape.Spec.Endpoints, 1)
assert.Contains(t, scrape.Spec.Endpoints[0].RelabelConfigs, victoriaMetricsAppRelabelConfig())
}
- f("VMSingle", &vmv1beta1.VMSingle{ObjectMeta: objectMeta})
- f("VMAlert", &vmv1beta1.VMAlert{ObjectMeta: objectMeta})
- f("VMAuth", &vmv1beta1.VMAuth{ObjectMeta: objectMeta})
- f("VMSelect", &vmv1beta1.VMSelect{})
- f("VMInsert", &vmv1beta1.VMInsert{})
- f("VMStorage", &vmv1beta1.VMStorage{})
- f("VLSingle", &vmv1.VLSingle{ObjectMeta: objectMeta})
- f("VLSelect", &vmv1.VLSelect{})
- f("VLInsert", &vmv1.VLInsert{})
- f("VLStorage", &vmv1.VLStorage{})
- f("VTSingle", &vmv1.VTSingle{ObjectMeta: objectMeta})
- f("VTSelect", &vmv1.VTSelect{})
- f("VTInsert", &vmv1.VTInsert{})
- f("VTStorage", &vmv1.VTStorage{})
+ f("VMSingle", &vmv1beta1.VMSingle{ObjectMeta: objectMeta, Spec: vmv1beta1.VMSingleSpec{StandardAppsParams: sap}})
+ f("VMAlert", &vmv1beta1.VMAlert{ObjectMeta: objectMeta, Spec: vmv1beta1.VMAlertSpec{StandardAppsParams: sap}})
+ f("VMAuth", &vmv1beta1.VMAuth{ObjectMeta: objectMeta, Spec: vmv1beta1.VMAuthSpec{StandardAppsParams: sap}})
+ f("VMSelect", &vmv1beta1.VMSelect{StandardAppsParams: sap})
+ f("VMInsert", &vmv1beta1.VMInsert{StandardAppsParams: sap})
+ f("VMStorage", &vmv1beta1.VMStorage{StandardAppsParams: sap})
+ f("VLSingle", &vmv1.VLSingle{ObjectMeta: objectMeta, Spec: vmv1.VLSingleSpec{StandardAppsParams: sap}})
+ f("VLSelect", &vmv1.VLSelect{StandardAppsParams: sap})
+ f("VLInsert", &vmv1.VLInsert{StandardAppsParams: sap})
+ f("VLStorage", &vmv1.VLStorage{StandardAppsParams: sap})
+ f("VTSingle", &vmv1.VTSingle{ObjectMeta: objectMeta, Spec: vmv1.VTSingleSpec{StandardAppsParams: sap}})
+ f("VTSelect", &vmv1.VTSelect{StandardAppsParams: sap})
+ f("VTInsert", &vmv1.VTInsert{StandardAppsParams: sap})
+ f("VTStorage", &vmv1.VTStorage{StandardAppsParams: sap})
}
func TestVMPodScrapeObjectsAddVictoriaMetricsAppLabel(t *testing.T) {
objectMeta := metav1.ObjectMeta{Name: "test", Namespace: "default"}
+ sap := vmv1beta1.StandardAppsParams{HTTPListeners: []vmv1beta1.HTTPListener{{Name: "http"}}}
- f := func(builder podScrapeBuilder, port string) {
- scrape := VMPodScrape(builder, port)
+ f := func(builder podScrapeBuilder) {
+ scrape := VMPodScrape(builder)
assert.Len(t, scrape.Spec.PodMetricsEndpoints, 1)
assert.Contains(t, scrape.Spec.PodMetricsEndpoints[0].RelabelConfigs, victoriaMetricsAppRelabelConfig())
}
- f(&vmv1beta1.VMAgent{ObjectMeta: objectMeta}, "http")
- f(&vmv1.VLAgent{ObjectMeta: objectMeta}, "http")
- f(&vmv1.VMAnomaly{ObjectMeta: objectMeta}, "monitoring-http")
+ f(&vmv1beta1.VMAgent{ObjectMeta: objectMeta, Spec: vmv1beta1.VMAgentSpec{StandardAppsParams: sap}})
+ f(&vmv1.VLAgent{ObjectMeta: objectMeta, Spec: vmv1.VLAgentSpec{StandardAppsParams: sap}})
+ f(&vmv1.VMAnomaly{ObjectMeta: objectMeta})
}
diff --git a/internal/controller/operator/factory/finalize/cluster.go b/internal/controller/operator/factory/finalize/cluster.go
index 24d0c8af79..e97e31bf85 100644
--- a/internal/controller/operator/factory/finalize/cluster.go
+++ b/internal/controller/operator/factory/finalize/cluster.go
@@ -15,10 +15,9 @@ import (
vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
"github.com/VictoriaMetrics/operator/internal/config"
- "github.com/VictoriaMetrics/operator/internal/controller/operator/factory/build"
)
-func OnClusterDelete(ctx context.Context, rclient client.Client, cr build.ParentOpts) error {
+func OnClusterDelete(ctx context.Context, rclient client.Client, cr vmv1beta1.ParentOpts) error {
if err := OnClusterLoadBalancerDelete(ctx, rclient, cr, false); err != nil {
return fmt.Errorf("cannot delete cluster loadbalancer components: %w", err)
}
@@ -32,7 +31,7 @@ func OnClusterDelete(ctx context.Context, rclient client.Client, cr build.Parent
if err := OnStorageDelete(ctx, rclient, cr, false); err != nil {
return fmt.Errorf("cannot remove storage component objects: %w", err)
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
ls := b.SelectorLabels()
delete(ls, "app.kubernetes.io/name")
b.SetSelectorLabels(ls)
@@ -51,8 +50,8 @@ func OnClusterDelete(ctx context.Context, rclient client.Client, cr build.Parent
}
// OnInsertDelete removes all objects related to insert component
-func OnInsertDelete(ctx context.Context, rclient client.Client, cr build.ParentOpts, shouldRemove bool) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+func OnInsertDelete(ctx context.Context, rclient client.Client, cr vmv1beta1.ParentOpts, shouldRemove bool) error {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
if err := RemoveOrphanedVMServiceScrapes(ctx, rclient, b, nil, shouldRemove); err != nil {
return fmt.Errorf("cannot remove orphaned serviceScrapes: %w", err)
}
@@ -79,8 +78,8 @@ func OnInsertDelete(ctx context.Context, rclient client.Client, cr build.ParentO
}
// OnSelectDelete removes all objects related to select component
-func OnSelectDelete(ctx context.Context, rclient client.Client, cr build.ParentOpts, shouldRemove bool) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+func OnSelectDelete(ctx context.Context, rclient client.Client, cr vmv1beta1.ParentOpts, shouldRemove bool) error {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
if err := RemoveOrphanedVMServiceScrapes(ctx, rclient, b, nil, shouldRemove); err != nil {
return fmt.Errorf("cannot remove orphaned serviceScrapes: %w", err)
}
@@ -108,8 +107,8 @@ func OnSelectDelete(ctx context.Context, rclient client.Client, cr build.ParentO
}
// OnStorageDelete removes all objects related to storage component
-func OnStorageDelete(ctx context.Context, rclient client.Client, cr build.ParentOpts, shouldRemove bool) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+func OnStorageDelete(ctx context.Context, rclient client.Client, cr vmv1beta1.ParentOpts, shouldRemove bool) error {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
if err := RemoveOrphanedVMServiceScrapes(ctx, rclient, b, nil, shouldRemove); err != nil {
return fmt.Errorf("cannot remove orphaned serviceScrapes: %w", err)
}
@@ -136,8 +135,8 @@ func OnStorageDelete(ctx context.Context, rclient client.Client, cr build.Parent
}
// OnClusterLoadBalancerDelete removes vmauth loadbalancer components for cluster
-func OnClusterLoadBalancerDelete(ctx context.Context, rclient client.Client, cr build.ParentOpts, shouldRemove bool) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+func OnClusterLoadBalancerDelete(ctx context.Context, rclient client.Client, cr vmv1beta1.ParentOpts, shouldRemove bool) error {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
if err := RemoveOrphanedVMServiceScrapes(ctx, rclient, b, nil, shouldRemove); err != nil {
return fmt.Errorf("cannot remove orphaned serviceScrapes: %w", err)
}
@@ -213,8 +212,8 @@ func (cc *ChildCleaner) KeepScrape(v string) {
}
// RemoveOrphaned removes cr dependent resources excluding ones, which are defined in cleaner's maps
-func (cc *ChildCleaner) RemoveOrphaned(ctx context.Context, rclient client.Client, cr build.ParentOpts) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentCommon)
+func (cc *ChildCleaner) RemoveOrphaned(ctx context.Context, rclient client.Client, cr vmv1beta1.ParentOpts) error {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentCommon)
if err := RemoveOrphanedPDBs(ctx, rclient, b, cc.pdbs, true); err != nil {
return fmt.Errorf("cannot remove orphaned PDBs: %w", err)
}
diff --git a/internal/controller/operator/factory/finalize/cluster_test.go b/internal/controller/operator/factory/finalize/cluster_test.go
index 746e2b946c..3c22a64955 100644
--- a/internal/controller/operator/factory/finalize/cluster_test.go
+++ b/internal/controller/operator/factory/finalize/cluster_test.go
@@ -15,7 +15,6 @@ import (
"k8s.io/apimachinery/pkg/types"
vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
- "github.com/VictoriaMetrics/operator/internal/controller/operator/factory/build"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/k8stools"
)
@@ -33,7 +32,7 @@ func TestOnClusterDelete(t *testing.T) {
},
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
saMeta := metav1.ObjectMeta{
Name: b.GetServiceAccountName(),
Namespace: b.GetNamespace(),
@@ -46,7 +45,7 @@ func TestOnClusterDelete(t *testing.T) {
Namespace: cr.GetNamespace(),
Finalizers: []string{vmv1beta1.FinalizerName},
OwnerReferences: []metav1.OwnerReference{cr.AsOwner()},
- Labels: build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert).SelectorLabels(),
+ Labels: vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert).SelectorLabels(),
}
cl := k8stools.GetTestClientWithObjects([]runtime.Object{
@@ -117,7 +116,7 @@ func TestOnInsertDelete(t *testing.T) {
Namespace: cr.GetNamespace(),
Finalizers: []string{vmv1beta1.FinalizerName},
OwnerReferences: []metav1.OwnerReference{cr.AsOwner()},
- Labels: build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert).SelectorLabels(),
+ Labels: vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert).SelectorLabels(),
}
predefined := []runtime.Object{
cr.DeepCopy(),
@@ -179,7 +178,7 @@ func TestOnSelectDelete(t *testing.T) {
Namespace: cr.GetNamespace(),
Finalizers: []string{vmv1beta1.FinalizerName},
OwnerReferences: []metav1.OwnerReference{cr.AsOwner()},
- Labels: build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect).SelectorLabels(),
+ Labels: vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect).SelectorLabels(),
}
predefined := []runtime.Object{
cr.DeepCopy(),
@@ -243,7 +242,7 @@ func TestOnStorageDelete(t *testing.T) {
Namespace: cr.GetNamespace(),
Finalizers: []string{vmv1beta1.FinalizerName},
OwnerReferences: []metav1.OwnerReference{cr.AsOwner()},
- Labels: build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage).SelectorLabels(),
+ Labels: vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage).SelectorLabels(),
}
predefined := []runtime.Object{
cr.DeepCopy(),
@@ -306,7 +305,7 @@ func TestOnClusterLoadBalancerDelete(t *testing.T) {
Namespace: cr.GetNamespace(),
Finalizers: []string{vmv1beta1.FinalizerName},
OwnerReferences: []metav1.OwnerReference{cr.AsOwner()},
- Labels: build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer).SelectorLabels(),
+ Labels: vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer).SelectorLabels(),
}
predefined := []runtime.Object{
diff --git a/internal/controller/operator/factory/reconcile/vmagent_test.go b/internal/controller/operator/factory/reconcile/vmagent_test.go
index 95ff0a7465..b013dcd749 100644
--- a/internal/controller/operator/factory/reconcile/vmagent_test.go
+++ b/internal/controller/operator/factory/reconcile/vmagent_test.go
@@ -30,8 +30,10 @@ func TestVMAgentReconcile(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
}
diff --git a/internal/controller/operator/factory/reconcile/vmauth_test.go b/internal/controller/operator/factory/reconcile/vmauth_test.go
index 682ae7f5ca..7950620486 100644
--- a/internal/controller/operator/factory/reconcile/vmauth_test.go
+++ b/internal/controller/operator/factory/reconcile/vmauth_test.go
@@ -29,8 +29,10 @@ func TestVMAuthReconcile(t *testing.T) {
Finalizers: []string{vmv1beta1.FinalizerName},
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
}
diff --git a/internal/controller/operator/factory/reconcile/vmcluster_test.go b/internal/controller/operator/factory/reconcile/vmcluster_test.go
index f63dd354ce..a01681b1b4 100644
--- a/internal/controller/operator/factory/reconcile/vmcluster_test.go
+++ b/internal/controller/operator/factory/reconcile/vmcluster_test.go
@@ -112,7 +112,11 @@ func TestVMClusterReconcile(t *testing.T) {
// vmselect configmaps added
f(opts{
new: getVMCluster(func(v *vmv1beta1.VMCluster) {
- v.Spec.VMSelect = &vmv1beta1.VMSelect{CommonAppsParams: vmv1beta1.CommonAppsParams{ConfigMaps: []string{"cm1"}}}
+ v.Spec.VMSelect = &vmv1beta1.VMSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ConfigMaps: []string{"cm1"}},
+ },
+ }
}),
prev: getVMCluster(),
predefinedObjects: []runtime.Object{
@@ -134,11 +138,19 @@ func TestVMClusterReconcile(t *testing.T) {
v.Spec.VMSelect = &vmv1beta1.VMSelect{}
}),
prev: getVMCluster(func(v *vmv1beta1.VMCluster) {
- v.Spec.VMSelect = &vmv1beta1.VMSelect{CommonAppsParams: vmv1beta1.CommonAppsParams{ConfigMaps: []string{"cm1"}}}
+ v.Spec.VMSelect = &vmv1beta1.VMSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ConfigMaps: []string{"cm1"}},
+ },
+ }
}),
predefinedObjects: []runtime.Object{
getVMCluster(func(v *vmv1beta1.VMCluster) {
- v.Spec.VMSelect = &vmv1beta1.VMSelect{CommonAppsParams: vmv1beta1.CommonAppsParams{ConfigMaps: []string{"cm1"}}}
+ v.Spec.VMSelect = &vmv1beta1.VMSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ConfigMaps: []string{"cm1"}},
+ },
+ }
v.Status.UpdateStatus = vmv1beta1.UpdateStatusOperational
v.Status.ObservedGeneration = v.Generation
}),
diff --git a/internal/controller/operator/factory/reconcile/vmpodscrape.go b/internal/controller/operator/factory/reconcile/vmpodscrape.go
index c255ca37a2..146c2ff1ad 100644
--- a/internal/controller/operator/factory/reconcile/vmpodscrape.go
+++ b/internal/controller/operator/factory/reconcile/vmpodscrape.go
@@ -20,6 +20,9 @@ func VMPodScrape(ctx context.Context, rclient client.Client, newObj, prevObj *vm
if build.IsControllerDisabled("VMPodScrape") {
return nil
}
+ if newObj == nil {
+ return nil
+ }
nsn := types.NamespacedName{Name: newObj.Name, Namespace: newObj.Namespace}
var prevMeta *metav1.ObjectMeta
if prevObj != nil {
diff --git a/internal/controller/operator/factory/reconcile/vmservicescrape.go b/internal/controller/operator/factory/reconcile/vmservicescrape.go
index 38acd2ac23..1663e6a1ad 100644
--- a/internal/controller/operator/factory/reconcile/vmservicescrape.go
+++ b/internal/controller/operator/factory/reconcile/vmservicescrape.go
@@ -20,6 +20,9 @@ func VMServiceScrape(ctx context.Context, rclient client.Client, newObj, prevObj
if build.IsControllerDisabled("VMServiceScrape") {
return nil
}
+ if newObj == nil {
+ return nil
+ }
nsn := types.NamespacedName{Name: newObj.Name, Namespace: newObj.Namespace}
var prevMeta *metav1.ObjectMeta
if prevObj != nil {
diff --git a/internal/controller/operator/factory/vlagent/vlagent.go b/internal/controller/operator/factory/vlagent/vlagent.go
index b0cf218707..d34d15b5b4 100644
--- a/internal/controller/operator/factory/vlagent/vlagent.go
+++ b/internal/controller/operator/factory/vlagent/vlagent.go
@@ -16,7 +16,6 @@ import (
policyv1 "k8s.io/api/policy/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
@@ -45,6 +44,7 @@ func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevC
var prevService, prevAdditionalService *corev1.Service
if prevCR != nil {
prevService = build.Service(prevCR, prevCR.Spec.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.HTTPListeners)
svc.Spec.ClusterIP = "None"
syslogSpec := prevCR.Spec.SyslogSpec
build.AddSyslogPortsToService(svc, syslogSpec)
@@ -52,6 +52,7 @@ func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevC
prevAdditionalService = build.AdditionalServiceFromDefault(prevService, cr.Spec.ServiceSpec)
}
newService := build.Service(cr, cr.Spec.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.HTTPListeners)
svc.Spec.ClusterIP = "None"
syslogSpec := cr.Spec.SyslogSpec
build.AddSyslogPortsToService(svc, syslogSpec)
@@ -81,7 +82,7 @@ func buildScrape(cr *vmv1.VLAgent) *vmv1beta1.VMPodScrape {
if cr == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- return build.VMPodScrape(cr, "http")
+ return build.VMPodScrape(cr)
}
// CreateOrUpdate creates deployment for vlagent and configures it
@@ -278,7 +279,6 @@ func newPodSpec(cr *vmv1.VLAgent) (*corev1.PodSpec, error) {
}
cfg := config.MustGetBaseConfig()
- args = append(args, fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Port))
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -397,8 +397,13 @@ func newPodSpec(cr *vmv1.VLAgent) (*corev1.PodSpec, error) {
var envs []corev1.EnvVar
envs = append(envs, cr.Spec.ExtraEnvs...)
var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(cr.Spec.Port).IntVal})
+ vmMounts = append(vmMounts, cr.Spec.VolumeMounts...)
+ volumes = append(volumes, cr.Spec.Volumes...)
+
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.HTTPListeners)
if cr.Spec.SyslogSpec != nil {
args = build.AddSyslogArgsTo(args, cr.Spec.SyslogSpec, tlsServerConfigMountPath)
volumes, vmMounts = build.AddSyslogTLSConfigToVolumes(volumes, vmMounts, cr.Spec.SyslogSpec, tlsServerConfigMountPath)
@@ -408,9 +413,6 @@ func newPodSpec(cr *vmv1.VLAgent) (*corev1.PodSpec, error) {
volumes, vmMounts = build.LicenseVolumeTo(volumes, vmMounts, cr.Spec.License, vmv1beta1.SecretsDir)
args = build.LicenseArgsTo(args, cr.Spec.License, vmv1beta1.SecretsDir)
- vmMounts = append(vmMounts, cr.Spec.VolumeMounts...)
- volumes = append(volumes, cr.Spec.Volumes...)
-
for _, s := range cr.Spec.Secrets {
volumes = append(volumes, corev1.Volume{
Name: k8stools.SanitizeVolumeName("secret-" + s),
diff --git a/internal/controller/operator/factory/vlagent/vlagent_test.go b/internal/controller/operator/factory/vlagent/vlagent_test.go
index b61eb93fbb..cfd449dc73 100644
--- a/internal/controller/operator/factory/vlagent/vlagent_test.go
+++ b/internal/controller/operator/factory/vlagent/vlagent_test.go
@@ -67,8 +67,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
Storage: &vmv1beta1.StorageSpec{
VolumeClaimTemplate: vmv1beta1.EmbeddedPersistentVolumeClaim{
@@ -125,8 +127,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://remote-write"},
@@ -205,8 +209,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
Storage: &vmv1beta1.StorageSpec{
VolumeClaimTemplate: vmv1beta1.EmbeddedPersistentVolumeClaim{
@@ -263,8 +269,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{
@@ -317,8 +325,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{
@@ -443,9 +453,11 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- TerminationGracePeriodSeconds: ptr.To[int64](60),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ TerminationGracePeriodSeconds: ptr.To[int64](60),
+ },
},
},
},
@@ -470,8 +482,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -985,22 +999,24 @@ func TestMakeSpecForAgentOk(t *testing.T) {
f(&vmv1.VLAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "vm-repo",
- Tag: "v1.97.1",
- },
- Resources: corev1.ResourceRequirements{
- Limits: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("10m"),
- corev1.ResourceMemory: resource.MustParse("10Mi"),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "vm-repo",
+ Tag: "v1.97.1",
},
- Requests: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("10m"),
- corev1.ResourceMemory: resource.MustParse("10Mi"),
+ Resources: corev1.ResourceRequirements{
+ Limits: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("10m"),
+ corev1.ResourceMemory: resource.MustParse("10Mi"),
+ },
+ Requests: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("10m"),
+ corev1.ResourceMemory: resource.MustParse("10Mi"),
+ },
},
+ Port: "9425",
},
- Port: "9425",
},
},
}, []runtime.Object{}, `
@@ -1063,12 +1079,14 @@ serviceaccountname: vlagent-agent
f(&vmv1.VLAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "9429",
},
- UseDefaultResources: ptr.To(false),
- Port: "9429",
},
},
}, []runtime.Object{}, `
@@ -1120,12 +1138,14 @@ serviceaccountname: vlagent-agent
f(&vmv1.VLAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "9425",
},
- UseDefaultResources: ptr.To(false),
- Port: "9425",
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{
@@ -1193,12 +1213,14 @@ serviceaccountname: vlagent-agent
f(&vmv1.VLAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.52.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.52.0",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "9425",
},
- UseDefaultResources: ptr.To(false),
- Port: "9425",
},
K8sCollector: vmv1.VLAgentK8sCollector{
Enabled: true,
@@ -1292,12 +1314,14 @@ volumes:
f(&vmv1.VLAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "9425",
},
- UseDefaultResources: ptr.To(false),
- Port: "9425",
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{
@@ -1367,14 +1391,16 @@ serviceaccountname: vlagent-agent
f(&vmv1.VLAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v0.0.1",
- },
- UseDefaultResources: ptr.To(false),
- Port: "9425",
- ExtraArgs: map[string]string{
- "remoteWrite.maxDiskUsagePerURL": "35GiB",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v0.0.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "9425",
+ ExtraArgs: map[string]string{
+ "remoteWrite.maxDiskUsagePerURL": "35GiB",
+ },
},
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
@@ -1445,13 +1471,15 @@ serviceaccountname: vlagent-agent
f(&vmv1.VLAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "9429",
+ TerminationGracePeriodSeconds: ptr.To[int64](40),
},
- UseDefaultResources: ptr.To(false),
- Port: "9429",
- TerminationGracePeriodSeconds: ptr.To[int64](40),
},
},
}, []runtime.Object{}, `
@@ -1511,9 +1539,11 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Paused: true,
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vlcluster/vlcluster.go b/internal/controller/operator/factory/vlcluster/vlcluster.go
index 9b0473e6ad..ad32829568 100644
--- a/internal/controller/operator/factory/vlcluster/vlcluster.go
+++ b/internal/controller/operator/factory/vlcluster/vlcluster.go
@@ -45,11 +45,11 @@ func CreateOrUpdate(ctx context.Context, rclient client.Client, cr *vmv1.VLClust
}
}
if cr.IsOwnsServiceAccount() {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
sa := build.ServiceAccount(b)
var prevSA *corev1.ServiceAccount
if prevCR != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentRoot)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentRoot)
prevSA = build.ServiceAccount(b)
}
owner := cr.AsOwner()
@@ -206,7 +206,7 @@ func deleteOrphaned(ctx context.Context, rclient client.Client, cr *vmv1.VLClust
}
}
if !cr.IsOwnsServiceAccount() {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
objMeta := metav1.ObjectMeta{Name: b.PrefixedName(), Namespace: b.GetNamespace()}
objsToRemove := []client.Object{&corev1.ServiceAccount{ObjectMeta: objMeta}}
if err := finalize.SafeDeleteWithFinalizer(ctx, rclient, objsToRemove, b); err != nil {
diff --git a/internal/controller/operator/factory/vlcluster/vlcluster_test.go b/internal/controller/operator/factory/vlcluster/vlcluster_test.go
index ccc3d6a100..4f15c7d648 100644
--- a/internal/controller/operator/factory/vlcluster/vlcluster_test.go
+++ b/internal/controller/operator/factory/vlcluster/vlcluster_test.go
@@ -75,18 +75,24 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VLClusterSpec{
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
},
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
},
},
},
@@ -189,8 +195,10 @@ func TestCreateOrUpdate(t *testing.T) {
RetentionPeriod: "1w",
RetentionMaxDiskSpaceUsageBytes: "5GB",
FutureRetention: "2d",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -219,14 +227,18 @@ func TestCreateOrUpdate(t *testing.T) {
Addr: "localhost:10101",
},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1w",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -259,14 +271,18 @@ func TestCreateOrUpdate(t *testing.T) {
Addr: "localhost:10101",
},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1w",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
HPA: &vmv1beta1.EmbeddedHPA{
MinReplicas: ptr.To(int32(0)),
@@ -287,8 +303,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1.VLClusterSpec{
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -350,8 +368,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1.VLClusterSpec{
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -424,8 +444,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1.VLClusterSpec{
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -511,8 +533,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1.VLClusterSpec{
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -610,8 +634,10 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VLClusterSpec{
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
},
},
@@ -649,13 +675,25 @@ func TestCreateOrUpdate(t *testing.T) {
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
},
},
@@ -689,13 +727,25 @@ func TestCreateOrUpdate(t *testing.T) {
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
},
},
@@ -719,18 +769,24 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VLClusterSpec{
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
ManagedMetadata: &vmv1beta1.ManagedObjectsMetadata{
@@ -777,18 +833,24 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VLClusterSpec{
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -828,18 +890,24 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
Spec: vmv1.VLClusterSpec{
Paused: true,
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -912,13 +980,25 @@ func TestCreateOrUpdate_LBDeploymentWithHPA(t *testing.T) {
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vlcluster/vlinsert.go b/internal/controller/operator/factory/vlcluster/vlinsert.go
index 4cc6275f3b..b29e3a0519 100644
--- a/internal/controller/operator/factory/vlcluster/vlinsert.go
+++ b/internal/controller/operator/factory/vlcluster/vlinsert.go
@@ -13,7 +13,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -35,11 +34,11 @@ func createOrUpdateVLInsert(ctx context.Context, rclient client.Client, cr, prev
return err
}
if cr.Spec.VLInsert.NetworkPolicy != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
np := build.NetworkPolicy(b, cr.Spec.VLInsert.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.VLInsert != nil && prevCR.Spec.VLInsert.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevNP = build.NetworkPolicy(b, prevCR.Spec.VLInsert.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -63,11 +62,11 @@ func createOrUpdatePodDisruptionBudgetForVLInsert(ctx context.Context, rclient c
if cr.Spec.VLInsert.PodDisruptionBudget == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
pdb := build.PodDisruptionBudget(b, cr.Spec.VLInsert.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.VLInsert.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.VLInsert.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -140,7 +139,6 @@ func buildVLInsertDeployment(cr *vmv1.VLCluster) (*appsv1.Deployment, error) {
func buildVLInsertPodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error) {
cfg := config.MustGetBaseConfig()
args := []string{
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.VLInsert.Port),
"-internalselect.disable=true",
}
if cfg.EnableTCP6 {
@@ -157,7 +155,7 @@ func buildVLInsertPodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error) {
storageNodeIds := cr.AvailableStorageNodeIDs(vmv1beta1.ClusterComponentInsert)
for idx, i := range storageNodeIds {
// TODO: introduce TLS webserver config for storage nodes
- storageNodeFlag.Add(vmv1beta1.PodDNSAddress(cr.PrefixedName(vmv1beta1.ClusterComponentStorage), i, cr.Namespace, cr.Spec.VLStorage.Port, cr.Spec.ClusterDomainName), idx)
+ storageNodeFlag.Add(vmv1beta1.PodDNSAddress(cr.PrefixedName(vmv1beta1.ClusterComponentStorage), i, cr.Namespace, cr.Spec.VLStorage.PrimaryPort(cr.Spec.VLStorage.Port), cr.Spec.ClusterDomainName), idx)
}
totalNodes := len(storageNodeIds)
args = build.AppendFlagsToArgs(args, totalNodes, storageNodeFlag)
@@ -169,20 +167,16 @@ func buildVLInsertPodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error) {
envs = append(envs, cr.Spec.VLInsert.ExtraEnvs...)
- ports := []corev1.ContainerPort{
- {
- Name: "http",
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.VLInsert.Port).IntVal,
- },
- }
-
volumes := make([]corev1.Volume, 0)
volumes = append(volumes, cr.Spec.VLInsert.Volumes...)
vmMounts := make([]corev1.VolumeMount, 0)
vmMounts = append(vmMounts, cr.Spec.VLInsert.VolumeMounts...)
+ var ports []corev1.ContainerPort
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.VLInsert.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.VLInsert.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.VLInsert.HTTPListeners)
if cr.Spec.VLInsert.SyslogSpec != nil && !cr.Spec.RequestsLoadBalancer.Enabled {
ports = build.AddSyslogPortsTo(ports, cr.Spec.VLInsert.SyslogSpec)
args = build.AddSyslogArgsTo(args, cr.Spec.VLInsert.SyslogSpec, tlsServerConfigMountPath)
@@ -285,11 +279,11 @@ func createOrUpdateVLInsertHPA(ctx context.Context, rclient client.Client, cr, p
Kind: "Deployment",
APIVersion: "apps/v1",
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
newHPA := build.HPA(b, targetRef, cr.Spec.VLInsert.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.VLInsert.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.VLInsert.HPA)
}
owner := cr.AsOwner()
@@ -300,7 +294,7 @@ func createOrUpdateVLInsertVPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.VLInsert.VPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -309,7 +303,7 @@ func createOrUpdateVLInsertVPA(ctx context.Context, rclient client.Client, cr, p
newVPA := build.VPA(b, targetRef, cr.Spec.VLInsert.VPA)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.VLInsert != nil && prevCR.Spec.VLInsert.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.VLInsert.VPA)
}
owner := cr.AsOwner()
@@ -321,6 +315,9 @@ func buildVLInsertScrape(cr *vmv1.VLCluster, svc *corev1.Service) *vmv1beta1.VMS
return nil
}
svs := build.VMServiceScrape(svc, cr.Spec.VLInsert)
+ if svs == nil {
+ return nil
+ }
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableInsertBalancing {
svs.Spec.JobLabel = vmv1beta1.VMAuthLBServiceProxyJobNameLabel
}
@@ -360,10 +357,10 @@ func createOrUpdateVLInsertService(ctx context.Context, rclient client.Client, c
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableInsertBalancing {
var prevPort string
if prevCR != nil && prevCR.Spec.VLInsert != nil {
- prevPort = prevCR.Spec.VLInsert.Port
+ prevPort = prevCR.Spec.VLInsert.PrimaryPort(prevCR.Spec.VLInsert.Port)
}
kind := vmv1beta1.ClusterComponentInsert
- if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.VLInsert.Port, prevPort); err != nil {
+ if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.VLInsert.PrimaryPort(cr.Spec.VLInsert.Port), prevPort); err != nil {
return fmt.Errorf("cannot create lb svc for insert: %w", err)
}
}
@@ -380,8 +377,9 @@ func createOrUpdateVLInsertService(ctx context.Context, rclient client.Client, c
}
func buildVLInsertService(cr *vmv1.VLCluster) *corev1.Service {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
svc := build.Service(b, cr.Spec.VLInsert.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.VLInsert.HTTPListeners)
syslogSpec := cr.Spec.VLInsert.SyslogSpec
if syslogSpec == nil || cr.Spec.RequestsLoadBalancer.Enabled {
// fast path
diff --git a/internal/controller/operator/factory/vlcluster/vlselect.go b/internal/controller/operator/factory/vlcluster/vlselect.go
index f38f65986d..24a66fe1e2 100644
--- a/internal/controller/operator/factory/vlcluster/vlselect.go
+++ b/internal/controller/operator/factory/vlcluster/vlselect.go
@@ -13,7 +13,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -31,11 +30,11 @@ func createOrUpdateVLSelect(ctx context.Context, rclient client.Client, cr, prev
return nil
}
if cr.Spec.VLSelect.PodDisruptionBudget != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
pdb := build.PodDisruptionBudget(b, cr.Spec.VLSelect.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.VLSelect.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.VLSelect.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -45,11 +44,11 @@ func createOrUpdateVLSelect(ctx context.Context, rclient client.Client, cr, prev
}
}
if cr.Spec.VLSelect.NetworkPolicy != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
np := build.NetworkPolicy(b, cr.Spec.VLSelect.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.VLSelect != nil && prevCR.Spec.VLSelect.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevNP = build.NetworkPolicy(b, prevCR.Spec.VLSelect.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -81,11 +80,11 @@ func createOrUpdateVLSelectHPA(ctx context.Context, rclient client.Client, cr, p
Kind: "Deployment",
APIVersion: "apps/v1",
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
defaultHPA := build.HPA(b, targetRef, cr.Spec.VLSelect.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.VLSelect.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.VLSelect.HPA)
}
owner := cr.AsOwner()
@@ -96,7 +95,7 @@ func createOrUpdateVLSelectVPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.VLSelect.VPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -105,7 +104,7 @@ func createOrUpdateVLSelectVPA(ctx context.Context, rclient client.Client, cr, p
newVPA := build.VPA(b, targetRef, cr.Spec.VLSelect.VPA)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.VLSelect != nil && prevCR.Spec.VLSelect.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.VLSelect.VPA)
}
owner := cr.AsOwner()
@@ -117,6 +116,9 @@ func buildVLSelectScrape(cr *vmv1.VLCluster, svc *corev1.Service) *vmv1beta1.VMS
return nil
}
svs := build.VMServiceScrape(svc, cr.Spec.VLSelect)
+ if svs == nil {
+ return nil
+ }
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableSelectBalancing {
svs.Spec.JobLabel = vmv1beta1.VMAuthLBServiceProxyJobNameLabel
}
@@ -154,10 +156,10 @@ func createOrUpdateVLSelectService(ctx context.Context, rclient client.Client, c
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableSelectBalancing {
var prevPort string
if prevCR != nil && prevCR.Spec.VLSelect != nil {
- prevPort = prevCR.Spec.VLSelect.Port
+ prevPort = prevCR.Spec.VLSelect.PrimaryPort(prevCR.Spec.VLSelect.Port)
}
kind := vmv1beta1.ClusterComponentSelect
- if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.VLSelect.Port, prevPort); err != nil {
+ if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.VLSelect.PrimaryPort(cr.Spec.VLSelect.Port), prevPort); err != nil {
return fmt.Errorf("cannot create lb svc for select: %w", err)
}
}
@@ -172,8 +174,9 @@ func createOrUpdateVLSelectService(ctx context.Context, rclient client.Client, c
}
func buildVLSelectService(cr *vmv1.VLCluster) *corev1.Service {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
svc := build.Service(b, cr.Spec.VLSelect.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.VLSelect.HTTPListeners)
svc.Spec.ClusterIP = "None"
svc.Spec.PublishNotReadyAddresses = true
})
@@ -246,7 +249,6 @@ func buildVLSelectDeployment(cr *vmv1.VLCluster) (*appsv1.Deployment, error) {
func buildVLSelectPodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error) {
cfg := config.MustGetBaseConfig()
args := []string{
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.VLSelect.Port),
"-internalinsert.disable=true",
}
if cfg.EnableTCP6 {
@@ -262,7 +264,7 @@ func buildVLSelectPodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error) {
storageNodeFlag := build.NewFlag("-storageNode", "")
storageNodeIds := cr.AvailableStorageNodeIDs(vmv1beta1.ClusterComponentSelect)
for idx, i := range storageNodeIds {
- storageNodeFlag.Add(vmv1beta1.PodDNSAddress(cr.PrefixedName(vmv1beta1.ClusterComponentStorage), i, cr.Namespace, cr.Spec.VLStorage.Port, cr.Spec.ClusterDomainName), idx)
+ storageNodeFlag.Add(vmv1beta1.PodDNSAddress(cr.PrefixedName(vmv1beta1.ClusterComponentStorage), i, cr.Namespace, cr.Spec.VLStorage.PrimaryPort(cr.Spec.VLStorage.Port), cr.Spec.ClusterDomainName), idx)
}
if len(cr.Spec.VLSelect.ExtraStorageNodes) > 0 {
for i, node := range cr.Spec.VLSelect.ExtraStorageNodes {
@@ -282,19 +284,17 @@ func buildVLSelectPodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error) {
var envs []corev1.EnvVar
envs = append(envs, cr.Spec.VLSelect.ExtraEnvs...)
- var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{
- Name: "http",
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.VLSelect.Port).IntVal,
- })
-
volumes := make([]corev1.Volume, 0)
volumes = append(volumes, cr.Spec.VLSelect.Volumes...)
vmMounts := make([]corev1.VolumeMount, 0)
vmMounts = append(vmMounts, cr.Spec.VLSelect.VolumeMounts...)
+ var ports []corev1.ContainerPort
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.VLSelect.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.VLSelect.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.VLSelect.HTTPListeners)
+
volumes, vmMounts = build.LicenseVolumeTo(volumes, vmMounts, cr.Spec.License, vmv1beta1.SecretsDir)
args = build.LicenseArgsTo(args, cr.Spec.License, vmv1beta1.SecretsDir)
diff --git a/internal/controller/operator/factory/vlcluster/vlstorage.go b/internal/controller/operator/factory/vlcluster/vlstorage.go
index 016eb4237b..99919c5d8e 100644
--- a/internal/controller/operator/factory/vlcluster/vlstorage.go
+++ b/internal/controller/operator/factory/vlcluster/vlstorage.go
@@ -13,7 +13,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -31,11 +30,11 @@ func createOrUpdateVLStorage(ctx context.Context, rclient client.Client, cr, pre
return nil
}
if cr.Spec.VLStorage.PodDisruptionBudget != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
pdb := build.PodDisruptionBudget(b, cr.Spec.VLStorage.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.VLStorage.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.VLStorage.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -45,11 +44,11 @@ func createOrUpdateVLStorage(ctx context.Context, rclient client.Client, cr, pre
}
}
if cr.Spec.VLStorage.NetworkPolicy != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
np := build.NetworkPolicy(b, cr.Spec.VLStorage.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.VLStorage != nil && prevCR.Spec.VLStorage.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevNP = build.NetworkPolicy(b, prevCR.Spec.VLStorage.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -80,15 +79,17 @@ func buildVLStorageScrape(cr *vmv1.VLCluster, svc *corev1.Service) *vmv1beta1.VM
}
func createOrUpdateVLStorageService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VLCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
- svc := build.Service(b, cr.Spec.VLStorage.Port, func(svc *corev1.Service) {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ svc := build.Service(b, cr.Spec.VLStorage.PrimaryPort(cr.Spec.VLStorage.Port), func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.VLStorage.HTTPListeners)
svc.Spec.ClusterIP = "None"
svc.Spec.PublishNotReadyAddresses = true
})
var prevSvc, prevAdditionalSvc *corev1.Service
if prevCR != nil && prevCR.Spec.VLStorage != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
- prevSvc = build.Service(b, prevCR.Spec.VLStorage.Port, func(svc *corev1.Service) {
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ prevSvc = build.Service(b, prevCR.Spec.VLStorage.PrimaryPort(prevCR.Spec.VLStorage.Port), func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.VLStorage.HTTPListeners)
svc.Spec.ClusterIP = "None"
svc.Spec.PublishNotReadyAddresses = true
})
@@ -127,7 +128,7 @@ func createOrUpdateVLStorageHPA(ctx context.Context, rclient client.Client, cr,
if hpa == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
targetRef := autoscalingv2.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "StatefulSet",
@@ -136,7 +137,7 @@ func createOrUpdateVLStorageHPA(ctx context.Context, rclient client.Client, cr,
defaultHPA := build.HPA(b, targetRef, hpa)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.VLStorage.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.VLStorage.HPA)
}
@@ -149,7 +150,7 @@ func createOrUpdateVLStorageVPA(ctx context.Context, rclient client.Client, cr,
if vpa == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "StatefulSet",
@@ -158,7 +159,7 @@ func createOrUpdateVLStorageVPA(ctx context.Context, rclient client.Client, cr,
newVPA := build.VPA(b, targetRef, vpa)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.VLStorage != nil && prevCR.Spec.VLStorage.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.VLStorage.VPA)
}
owner := cr.AsOwner()
@@ -236,7 +237,6 @@ func buildVLStorageSTSSpec(cr *vmv1.VLCluster) (*appsv1.StatefulSet, error) {
func buildVLStoragePodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error) {
cfg := config.MustGetBaseConfig()
args := []string{
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.VLStorage.Port),
fmt.Sprintf("-storageDataPath=%s", cr.Spec.VLStorage.StorageDataPath),
}
if cfg.EnableTCP6 {
@@ -273,13 +273,6 @@ func buildVLStoragePodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error)
envs = append(envs, cr.Spec.VLStorage.ExtraEnvs...)
- ports := []corev1.ContainerPort{
- {
- Name: "http",
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.VLStorage.Port).IntVal,
- },
- }
volumes := make([]corev1.Volume, 0)
vmMounts := make([]corev1.VolumeMount, 0)
@@ -291,6 +284,11 @@ func buildVLStoragePodSpec(cr *vmv1.VLCluster) (*corev1.PodTemplateSpec, error)
vmMounts = append(vmMounts, cr.Spec.VLStorage.VolumeMounts...)
+ var ports []corev1.ContainerPort
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.VLStorage.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.VLStorage.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.VLStorage.HTTPListeners)
+
volumes, vmMounts = build.LicenseVolumeTo(volumes, vmMounts, cr.Spec.License, vmv1beta1.SecretsDir)
args = build.LicenseArgsTo(args, cr.Spec.License, vmv1beta1.SecretsDir)
diff --git a/internal/controller/operator/factory/vlcluster/vmauth_lb.go b/internal/controller/operator/factory/vlcluster/vmauth_lb.go
index 045bf59aae..f166def838 100644
--- a/internal/controller/operator/factory/vlcluster/vmauth_lb.go
+++ b/internal/controller/operator/factory/vlcluster/vmauth_lb.go
@@ -66,11 +66,11 @@ func createOrUpdateVMAuthLB(ctx context.Context, rclient client.Client, cr, prev
}
}
if cr.Spec.RequestsLoadBalancer.Spec.NetworkPolicy != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
np := build.NetworkPolicy(b, cr.Spec.RequestsLoadBalancer.Spec.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevNP = build.NetworkPolicy(b, prevCR.Spec.RequestsLoadBalancer.Spec.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -88,7 +88,7 @@ func createOrUpdateVMAuthLBHPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.RequestsLoadBalancer.Spec.HPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
targetRef := autoscalingv2.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -97,7 +97,7 @@ func createOrUpdateVMAuthLBHPA(ctx context.Context, rclient client.Client, cr, p
newHPA := build.HPA(b, targetRef, cr.Spec.RequestsLoadBalancer.Spec.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.RequestsLoadBalancer.Spec.HPA)
}
owner := cr.AsOwner()
@@ -124,13 +124,13 @@ func buildVMauthLBSecret(cr *vmv1.VLCluster) *corev1.Secret {
insertProto := "http"
selectProto := "http"
if cr.Spec.VLSelect != nil {
- selectPort = cr.Spec.VLSelect.Port
+ selectPort = cr.Spec.VLSelect.PrimaryPort(cr.Spec.VLSelect.Port)
if cr.Spec.VLSelect.UseTLS() {
selectProto = "https"
}
}
if cr.Spec.VLInsert != nil {
- insertPort = cr.Spec.VLInsert.Port
+ insertPort = cr.Spec.VLInsert.PrimaryPort(cr.Spec.VLInsert.Port)
if cr.Spec.VLInsert.UseTLS() {
insertProto = "https"
}
@@ -283,6 +283,9 @@ func buildVMAuthScrape(cr *vmv1.VLCluster, svc *corev1.Service) *vmv1beta1.VMSer
return nil
}
svs := build.VMServiceScrape(svc, &cr.Spec.RequestsLoadBalancer.Spec)
+ if svs == nil {
+ return nil
+ }
if svs.Spec.Selector.MatchLabels == nil {
svs.Spec.Selector.MatchLabels = make(map[string]string)
}
@@ -291,8 +294,8 @@ func buildVMAuthScrape(cr *vmv1.VLCluster, svc *corev1.Service) *vmv1beta1.VMSer
}
func createOrUpdateVMAuthLBService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VLCluster) error {
- builder := func(r *vmv1.VLCluster) *build.ChildBuilder {
- b := build.NewChildBuilder(r, vmv1beta1.ClusterComponentBalancer)
+ builder := func(r *vmv1.VLCluster) *vmv1beta1.ChildBuilder {
+ b := vmv1beta1.NewChildBuilder(r, vmv1beta1.ClusterComponentBalancer)
b.SetFinalLabels(labels.Merge(b.FinalLabels(), map[string]string{
vmv1beta1.VMAuthLBServiceProxyTargetLabel: "vmauth",
}))
@@ -321,12 +324,12 @@ func createOrUpdateVMAuthLBService(ctx context.Context, rclient client.Client, c
}
func createOrUpdatePodDisruptionBudgetForVMAuthLB(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VLCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
pdb := build.PodDisruptionBudget(b, cr.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
owner := cr.AsOwner()
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget)
}
return reconcile.PDB(ctx, rclient, pdb, prevPDB, &owner)
@@ -334,8 +337,8 @@ func createOrUpdatePodDisruptionBudgetForVMAuthLB(ctx context.Context, rclient c
// createOrUpdateLBProxyService builds vlinsert and vlselect external services to expose vlcluster components for access by vmauth
func createOrUpdateLBProxyService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VLCluster, kind vmv1beta1.ClusterComponent, port, prevPort string) error {
- builder := func(r *vmv1.VLCluster) *build.ChildBuilder {
- b := build.NewChildBuilder(r, kind)
+ builder := func(r *vmv1.VLCluster) *vmv1beta1.ChildBuilder {
+ b := vmv1beta1.NewChildBuilder(r, kind)
b.SetFinalLabels(labels.Merge(b.FinalLabels(), map[string]string{
vmv1beta1.VMAuthLBServiceProxyTargetLabel: string(kind),
}))
diff --git a/internal/controller/operator/factory/vldistributed/test_clusterversion_test.go b/internal/controller/operator/factory/vldistributed/test_clusterversion_test.go
index 6f7be7cee5..e3b54f12d7 100644
--- a/internal/controller/operator/factory/vldistributed/test_clusterversion_test.go
+++ b/internal/controller/operator/factory/vldistributed/test_clusterversion_test.go
@@ -29,14 +29,28 @@ import (
func TestClusterVersionChange(t *testing.T) {
zoneSpec := vmv1alpha1.VLDistributedZoneCluster{
Spec: vmv1.VLClusterSpec{
- VLStorage: &vmv1.VLStorage{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))}},
- VLSelect: &vmv1.VLSelect{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))}},
- VLInsert: &vmv1.VLInsert{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))}},
+ VLStorage: &vmv1.VLStorage{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
+ },
+ VLSelect: &vmv1.VLSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
+ },
+ VLInsert: &vmv1.VLInsert{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
+ },
},
}
vmAuthSpec := vmv1alpha1.VLDistributedAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
},
}
diff --git a/internal/controller/operator/factory/vldistributed/util_test.go b/internal/controller/operator/factory/vldistributed/util_test.go
index bd3ad00db7..2e024e94ab 100644
--- a/internal/controller/operator/factory/vldistributed/util_test.go
+++ b/internal/controller/operator/factory/vldistributed/util_test.go
@@ -25,8 +25,10 @@ func TestMergeSpecs(t *testing.T) {
f(&vmv1.VLClusterSpec{
ClusterVersion: "v1.51.0",
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}, &vmv1.VLClusterSpec{
@@ -34,8 +36,10 @@ func TestMergeSpecs(t *testing.T) {
}, "zone-a", &vmv1.VLClusterSpec{
ClusterVersion: "v2.0.0",
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
})
@@ -44,10 +48,12 @@ func TestMergeSpecs(t *testing.T) {
f(&vmv1.VLClusterSpec{
ClusterVersion: "v1.51.0",
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- NodeSelector: map[string]string{
- "topology.kubernetes.io/zone": "%ZONE%",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ NodeSelector: map[string]string{
+ "topology.kubernetes.io/zone": "%ZONE%",
+ },
},
},
},
@@ -56,10 +62,12 @@ func TestMergeSpecs(t *testing.T) {
}, "zone-a", &vmv1.VLClusterSpec{
ClusterVersion: "v2.0.0",
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- NodeSelector: map[string]string{
- "topology.kubernetes.io/zone": "zone-a",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ NodeSelector: map[string]string{
+ "topology.kubernetes.io/zone": "zone-a",
+ },
},
},
},
@@ -75,15 +83,19 @@ func TestMergeSpecs(t *testing.T) {
}
f(&vmv1alpha1.VLDistributedZoneAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- NodeSelector: map[string]string{
- "topology.kubernetes.io/zone": "%ZONE%",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ NodeSelector: map[string]string{
+ "topology.kubernetes.io/zone": "%ZONE%",
+ },
},
},
}, &vmv1alpha1.VLDistributedZoneAgentSpec{}, "zone-b", &vmv1alpha1.VLDistributedZoneAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- NodeSelector: map[string]string{
- "topology.kubernetes.io/zone": "zone-b",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ NodeSelector: map[string]string{
+ "topology.kubernetes.io/zone": "zone-b",
+ },
},
},
})
diff --git a/internal/controller/operator/factory/vldistributed/vldistributed_reconcile_test.go b/internal/controller/operator/factory/vldistributed/vldistributed_reconcile_test.go
index dfc221966a..f59e67f33d 100644
--- a/internal/controller/operator/factory/vldistributed/vldistributed_reconcile_test.go
+++ b/internal/controller/operator/factory/vldistributed/vldistributed_reconcile_test.go
@@ -122,19 +122,27 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
zoneSpec := vmv1alpha1.VLDistributedZoneCluster{
Spec: vmv1.VLClusterSpec{
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
},
},
}
vmAuthSpec := vmv1alpha1.VLDistributedAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ },
},
}
@@ -492,18 +500,24 @@ func Test_CreateOrUpdate_Paused(t *testing.T) {
VLCluster: vmv1alpha1.VLDistributedZoneCluster{
Spec: vmv1.VLClusterSpec{
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
diff --git a/internal/controller/operator/factory/vldistributed/vldistributed_test.go b/internal/controller/operator/factory/vldistributed/vldistributed_test.go
index 6fb6377f06..eaaa444e78 100644
--- a/internal/controller/operator/factory/vldistributed/vldistributed_test.go
+++ b/internal/controller/operator/factory/vldistributed/vldistributed_test.go
@@ -18,6 +18,7 @@ import (
vmv1 "github.com/VictoriaMetrics/operator/api/operator/v1"
vmv1alpha1 "github.com/VictoriaMetrics/operator/api/operator/v1alpha1"
vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
+ "github.com/VictoriaMetrics/operator/internal/controller/operator/factory/build"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/k8stools"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/reconcile"
)
@@ -31,8 +32,10 @@ func newVLAgent(name, namespace string, owner metav1.OwnerReference) *vmv1.VLAge
OwnerReferences: []metav1.OwnerReference{owner},
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -50,18 +53,24 @@ func newVLCluster(name, namespace, version string, owner metav1.OwnerReference)
Spec: vmv1.VLClusterSpec{
ClusterVersion: version,
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -117,13 +126,19 @@ func beforeEach(o opts) *testData {
},
},
}
+ // mirror the defaulting reconcile always applies before GetRemoteWriteURL is used
+ scheme := k8stools.GetTestClientWithObjectsAndInterceptors(nil, interceptor.Funcs{}).Scheme()
+ build.AddDefaults(scheme)
+
var predefinedObjects []runtime.Object
var vlclusters []*vmv1.VLCluster
owner := cr.AsOwner()
for i := range cr.Spec.Zones {
name := fmt.Sprintf("vlcluster-%d", i+1)
vlCluster := newVLCluster(name, namespace, "v1.51.0", owner)
+ scheme.Default(vlCluster)
vlAgent := newVLAgent(name, namespace, owner)
+ scheme.Default(vlAgent)
zs.backends = append(zs.backends, vlBackend{obj: vlCluster})
zs.vlagents = append(zs.vlagents, vlAgent)
vlclusters = append(vlclusters, vlCluster)
diff --git a/internal/controller/operator/factory/vlsingle/vlsingle.go b/internal/controller/operator/factory/vlsingle/vlsingle.go
index 124e1bd474..c012df9bbf 100644
--- a/internal/controller/operator/factory/vlsingle/vlsingle.go
+++ b/internal/controller/operator/factory/vlsingle/vlsingle.go
@@ -12,7 +12,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
@@ -212,7 +211,6 @@ func makePodSpec(r *vmv1.VLSingle) (*corev1.PodTemplateSpec, error) {
args = append(args, "-logIngestedRows")
}
cfg := config.MustGetBaseConfig()
- args = append(args, fmt.Sprintf("-httpListenAddr=:%s", r.Spec.Port))
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -224,7 +222,6 @@ func makePodSpec(r *vmv1.VLSingle) (*corev1.PodTemplateSpec, error) {
envs = append(envs, r.Spec.ExtraEnvs...)
var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(r.Spec.Port).IntVal})
var pvcSrc *corev1.PersistentVolumeClaimVolumeSource
if !isStorageEmpty(r.Spec.Storage) {
@@ -270,6 +267,9 @@ func makePodSpec(r *vmv1.VLSingle) (*corev1.PodTemplateSpec, error) {
MountPath: path.Join(vmv1beta1.ConfigMapsDir, c),
})
}
+ args = build.AddHTTPListenerArgsTo(args, r.Spec.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, r.Spec.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, r.Spec.HTTPListeners)
if r.Spec.SyslogSpec != nil {
args = build.AddSyslogArgsTo(args, r.Spec.SyslogSpec, tlsServerConfigMountPath)
volumes, vmMounts = build.AddSyslogTLSConfigToVolumes(volumes, vmMounts, r.Spec.SyslogSpec, tlsServerConfigMountPath)
@@ -334,12 +334,14 @@ func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevC
var prevSvc, prevAdditionalSvc *corev1.Service
if prevCR != nil {
prevSvc = build.Service(prevCR, prevCR.Spec.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.HTTPListeners)
build.AddSyslogPortsToService(svc, prevCR.Spec.SyslogSpec)
})
prevAdditionalSvc = build.AdditionalServiceFromDefault(prevSvc, prevCR.Spec.ServiceSpec)
}
svc := build.Service(cr, cr.Spec.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.HTTPListeners)
build.AddSyslogPortsToService(svc, cr.Spec.SyslogSpec)
})
owner := cr.AsOwner()
diff --git a/internal/controller/operator/factory/vlsingle/vlsingle_test.go b/internal/controller/operator/factory/vlsingle/vlsingle_test.go
index 1b0b0b0210..f9e239c97a 100644
--- a/internal/controller/operator/factory/vlsingle/vlsingle_test.go
+++ b/internal/controller/operator/factory/vlsingle/vlsingle_test.go
@@ -67,8 +67,10 @@ func TestCreateOrUpdateVLSingle(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -104,10 +106,11 @@ func TestCreateOrUpdateVLSingle(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VLSingleSpec{
-
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Port: "8435",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Port: "8435",
+ },
},
},
},
@@ -143,9 +146,11 @@ func TestCreateOrUpdateVLSingle(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Port: "8435",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Port: "8435",
+ },
},
SyslogSpec: &vmv1.SyslogServerSpec{
TCPListeners: []*vmv1.SyslogTCPListener{
@@ -308,8 +313,10 @@ func TestCreateOrUpdateVLSingle_Paused(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Paused: true,
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vmagent/vmagent.go b/internal/controller/operator/factory/vmagent/vmagent.go
index ecc9052e8b..592631307d 100644
--- a/internal/controller/operator/factory/vmagent/vmagent.go
+++ b/internal/controller/operator/factory/vmagent/vmagent.go
@@ -19,7 +19,6 @@ import (
policyv1 "k8s.io/api/policy/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
@@ -45,38 +44,40 @@ const (
urlRelabelingName = "url_relabeling-%d.yaml"
globalAggregationConfigName = "global_aggregation.yaml"
- tlsAssetsDir = "/etc/vmagent-tls/certs"
- scrapeGzippedFilename = "vmagent.yaml.gz"
- configFilename = "vmagent.yaml"
- defaultMaxDiskUsage = "1073741824"
+ tlsAssetsDir = "/etc/vmagent-tls/certs"
+ tlsServerConfigMountPath = "/etc/vm/tls-server-secrets"
+ scrapeGzippedFilename = "vmagent.yaml.gz"
+ configFilename = "vmagent.yaml"
+ defaultMaxDiskUsage = "1073741824"
)
func buildVMAgentServiceScrape(cr *vmv1beta1.VMAgent, svc *corev1.Service) *vmv1beta1.VMServiceScrape {
if cr == nil || svc == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- scrape := build.VMServiceScrape(svc, cr)
+ var sidecars []build.ScrapeBuilder
if cr.HasConfigReloader() {
- scrape.Spec.Endpoints = append(scrape.Spec.Endpoints, build.ConfigReloaderVMServiceScrapeEndpoint())
+ sidecars = append(sidecars, build.ConfigReloaderScrapeBuilder)
}
- return scrape
+ return build.VMServiceScrape(svc, cr, sidecars...)
}
func buildVMAgentPodScrape(cr *vmv1beta1.VMAgent) *vmv1beta1.VMPodScrape {
if cr == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- scrape := build.VMPodScrape(cr, "http")
+ var sidecars []build.ScrapeBuilder
if cr.HasConfigReloader() {
- scrape.Spec.PodMetricsEndpoints = append(scrape.Spec.PodMetricsEndpoints, build.ConfigReloaderPodScrapeEndpoint())
+ sidecars = append(sidecars, build.ConfigReloaderScrapeBuilder)
}
- return scrape
+ return build.VMPodScrape(cr, sidecars...)
}
func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMAgent) error {
var prevSvc, prevAdditionalSvc *corev1.Service
if prevCR != nil {
prevSvc = build.Service(prevCR, prevCR.Spec.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.HTTPListeners)
if prevCR.Spec.StatefulMode {
svc.Spec.ClusterIP = "None"
}
@@ -85,6 +86,7 @@ func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevC
prevAdditionalSvc = build.AdditionalServiceFromDefault(prevSvc, cr.Spec.ServiceSpec)
}
svc := build.Service(cr, cr.Spec.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.HTTPListeners)
if cr.Spec.StatefulMode {
svc.Spec.ClusterIP = "None"
}
@@ -539,7 +541,6 @@ func newPodSpec(cr *vmv1beta1.VMAgent, ac *build.AssetsCache, extraConfigSecretC
}
cfg := config.MustGetBaseConfig()
- args = append(args, fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Port))
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -568,8 +569,7 @@ func newPodSpec(cr *vmv1beta1.VMAgent, ac *build.AssetsCache, extraConfigSecretC
})
}
- var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(cr.Spec.Port).IntVal})
+ ports := build.AddHTTPListenerPortsTo(nil, cr.Spec.HTTPListeners)
ports = build.AppendInsertPorts(ports, cr.Spec.InsertPorts)
var crMounts []corev1.VolumeMount
@@ -708,6 +708,8 @@ func newPodSpec(cr *vmv1beta1.VMAgent, ac *build.AssetsCache, extraConfigSecretC
args = build.StreamAggrArgsTo(args, "streamAggr", streamAggrKeys, streamAggrConfigs...)
args = build.AppendArgsForInsertPorts(args, cr.Spec.InsertPorts)
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
args = build.AddExtraArgsOverrideDefaults(args, cr.Spec.ExtraArgs, "-")
sort.Strings(args)
diff --git a/internal/controller/operator/factory/vmagent/vmagent_reconcile_test.go b/internal/controller/operator/factory/vmagent/vmagent_reconcile_test.go
index 1aed6318d4..033bfd3051 100644
--- a/internal/controller/operator/factory/vmagent/vmagent_reconcile_test.go
+++ b/internal/controller/operator/factory/vmagent/vmagent_reconcile_test.go
@@ -79,8 +79,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Status: vmv1beta1.VMAgentStatus{
@@ -88,8 +90,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -285,8 +289,10 @@ func TestCreateOrUpdate_StatefulSetWithHPA(t *testing.T) {
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
HPA: &vmv1beta1.EmbeddedHPA{
MinReplicas: ptr.To(int32(1)),
@@ -676,9 +682,11 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Paused: true,
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vmagent/vmagent_test.go b/internal/controller/operator/factory/vmagent/vmagent_test.go
index 022c72dfed..527d000e86 100644
--- a/internal/controller/operator/factory/vmagent/vmagent_test.go
+++ b/internal/controller/operator/factory/vmagent/vmagent_test.go
@@ -74,8 +74,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
StatefulMode: true,
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
@@ -141,18 +143,20 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Affinity: &corev1.Affinity{
- PodAntiAffinity: &corev1.PodAntiAffinity{
- RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{{
- LabelSelector: &metav1.LabelSelector{
- MatchLabels: map[string]string{
- "shard-num": "%SHARD_NUM%",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Affinity: &corev1.Affinity{
+ PodAntiAffinity: &corev1.PodAntiAffinity{
+ RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{{
+ LabelSelector: &metav1.LabelSelector{
+ MatchLabels: map[string]string{
+ "shard-num": "%SHARD_NUM%",
+ },
},
- },
- TopologyKey: "kubernetes.io/hostname",
- }},
+ TopologyKey: "kubernetes.io/hostname",
+ }},
+ },
},
},
},
@@ -446,8 +450,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
StatefulMode: true,
ServiceSpec: &vmv1beta1.AdditionalServiceSpec{
@@ -481,15 +487,17 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Volumes: []corev1.Volume{{
- Name: "persistent-queue-data",
- VolumeSource: corev1.VolumeSource{
- HostPath: &corev1.HostPathVolumeSource{
- Path: "/host/path/cache",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Volumes: []corev1.Volume{{
+ Name: "persistent-queue-data",
+ VolumeSource: corev1.VolumeSource{
+ HostPath: &corev1.HostPathVolumeSource{
+ Path: "/host/path/cache",
+ },
},
- },
- }},
+ }},
+ },
},
DaemonSetMode: true,
},
@@ -552,8 +560,10 @@ func TestCreateOrUpdate(t *testing.T) {
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(true),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](2),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](2),
+ },
},
ShardCount: ptr.To[int32](3),
PodDisruptionBudget: &vmv1beta1.EmbeddedPodDisruptionBudgetSpec{
@@ -622,8 +632,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
StatefulMode: true,
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
@@ -686,8 +698,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
StatefulMode: true,
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
@@ -2518,22 +2532,24 @@ func TestMakeSpecForAgentOk(t *testing.T) {
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(true),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "vm-repo",
- Tag: "v1.97.1",
- },
- Resources: corev1.ResourceRequirements{
- Limits: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("10m"),
- corev1.ResourceMemory: resource.MustParse("10Mi"),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "vm-repo",
+ Tag: "v1.97.1",
},
- Requests: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("10m"),
- corev1.ResourceMemory: resource.MustParse("10Mi"),
+ Resources: corev1.ResourceRequirements{
+ Limits: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("10m"),
+ corev1.ResourceMemory: resource.MustParse("10Mi"),
+ },
+ Requests: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("10m"),
+ corev1.ResourceMemory: resource.MustParse("10Mi"),
+ },
},
+ Port: "8425",
},
- Port: "8425",
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: "vmcustom:config-reloader-v0.35.0",
@@ -2610,22 +2626,24 @@ serviceaccountname: vmagent-agent`,
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(true),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "vm-repo",
- Tag: "v1.97.1",
- },
- Resources: corev1.ResourceRequirements{
- Limits: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("10m"),
- corev1.ResourceMemory: resource.MustParse("10Mi"),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "vm-repo",
+ Tag: "v1.97.1",
},
- Requests: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("10m"),
- corev1.ResourceMemory: resource.MustParse("10Mi"),
+ Resources: corev1.ResourceRequirements{
+ Limits: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("10m"),
+ corev1.ResourceMemory: resource.MustParse("10Mi"),
+ },
+ Requests: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("10m"),
+ corev1.ResourceMemory: resource.MustParse("10Mi"),
+ },
},
+ Port: "8425",
},
- Port: "8425",
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{
@@ -2767,12 +2785,14 @@ serviceaccountname: vmagent-agent`,
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(false),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "8429",
},
- UseDefaultResources: ptr.To(false),
- Port: "8429",
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: "vmcustomer:v1",
@@ -2912,12 +2932,14 @@ serviceaccountname: vmagent-agent
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(true),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "8425",
},
- UseDefaultResources: ptr.To(false),
- Port: "8425",
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: "vmcustom:config-reloader-v0.35.0",
@@ -2999,12 +3021,14 @@ serviceaccountname: vmagent-agent
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(true),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "8425",
},
- UseDefaultResources: ptr.To(false),
- Port: "8425",
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: "vmcustom:config-reloader-v0.35.0",
@@ -3089,15 +3113,17 @@ serviceaccountname: vmagent-agent
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(true),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
- },
- UseDefaultResources: ptr.To(false),
- Port: "8425",
- ExtraArgs: map[string]string{
- "remoteWrite.maxDiskUsagePerURL": "35GiB",
- "remoteWrite.forceVMProto": "false",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "8425",
+ ExtraArgs: map[string]string{
+ "remoteWrite.maxDiskUsagePerURL": "35GiB",
+ "remoteWrite.forceVMProto": "false",
+ },
},
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
@@ -3185,12 +3211,14 @@ serviceaccountname: vmagent-agent
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(false),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "8429",
},
- UseDefaultResources: ptr.To(false),
- Port: "8429",
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: "vmcustomer:v1",
diff --git a/internal/controller/operator/factory/vmalert/vmalert.go b/internal/controller/operator/factory/vmalert/vmalert.go
index ff180f7779..d51f6ec689 100644
--- a/internal/controller/operator/factory/vmalert/vmalert.go
+++ b/internal/controller/operator/factory/vmalert/vmalert.go
@@ -14,7 +14,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
@@ -30,36 +29,41 @@ import (
const (
// vmAlertRulesOutDir is where the config-reloader writes decompressed rule files.
- vmAlertRulesOutDir = "/etc/vmalert/rules-out"
- vmAlertConfigDir = "/etc/vmalert/config"
- datasourceKey = "datasource"
- remoteReadKey = "remoteRead"
- remoteWriteKey = "remoteWrite"
- notifierConfigMountPath = `/etc/vm/notifier_config`
- vmalertConfigSecretsDir = "/etc/vmalert/remote_secrets"
- tlsAssetsDir = "/etc/vmalert-tls/certs"
+ vmAlertRulesOutDir = "/etc/vmalert/rules-out"
+ vmAlertConfigDir = "/etc/vmalert/config"
+ datasourceKey = "datasource"
+ remoteReadKey = "remoteRead"
+ remoteWriteKey = "remoteWrite"
+ notifierConfigMountPath = `/etc/vm/notifier_config`
+ vmalertConfigSecretsDir = "/etc/vmalert/remote_secrets"
+ tlsAssetsDir = "/etc/vmalert-tls/certs"
+ tlsServerConfigMountPath = "/etc/vm/tls-server-secrets"
)
func buildScrape(cr *vmv1beta1.VMAlert, svc *corev1.Service) *vmv1beta1.VMServiceScrape {
if cr == nil || svc == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- scrape := build.VMServiceScrape(svc, cr)
+ var sidecars []build.ScrapeBuilder
if cr.HasConfigReloader() {
- scrape.Spec.Endpoints = append(scrape.Spec.Endpoints, build.ConfigReloaderVMServiceScrapeEndpoint())
+ sidecars = append(sidecars, build.ConfigReloaderScrapeBuilder)
}
- return scrape
+ return build.VMServiceScrape(svc, cr, sidecars...)
}
// createOrUpdateService creates service for vmalert
func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMAlert) error {
var prevSvc, prevAdditionalSvc *corev1.Service
if prevCR != nil {
- prevSvc = build.Service(prevCR, prevCR.Spec.Port, nil)
+ prevSvc = build.Service(prevCR, prevCR.Spec.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.HTTPListeners)
+ })
prevAdditionalSvc = build.AdditionalServiceFromDefault(prevSvc, prevCR.Spec.ServiceSpec)
}
- svc := build.Service(cr, cr.Spec.Port, nil)
+ svc := build.Service(cr, cr.Spec.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.HTTPListeners)
+ })
owner := cr.AsOwner()
if err := cr.Spec.ServiceSpec.IsSomeAndThen(func(s *vmv1beta1.AdditionalServiceSpec) error {
additionalSvc := build.AdditionalServiceFromDefault(svc, s)
@@ -304,7 +308,8 @@ func newPodSpec(cr *vmv1beta1.VMAlert, ruleConfigMapNames []string, ac *build.As
ReadOnly: true,
})
var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(cr.Spec.Port).IntVal})
+ volumes, volumeMounts = build.AddHTTPListenerTLSToVolumes(volumes, volumeMounts, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.HTTPListeners)
// sort for consistency
sort.Strings(args)
@@ -577,7 +582,6 @@ func buildArgs(cr *vmv1beta1.VMAlert, ruleConfigMapNames []string, ac *build.Ass
}
cfg := config.MustGetBaseConfig()
- args = append(args, fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Port))
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -590,6 +594,7 @@ func buildArgs(cr *vmv1beta1.VMAlert, ruleConfigMapNames []string, ac *build.Ass
}
args = build.LicenseArgsTo(args, cr.Spec.License, vmv1beta1.SecretsDir)
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
args = build.AddExtraArgsOverrideDefaults(args, cr.Spec.ExtraArgs, "-")
sort.Strings(args)
diff --git a/internal/controller/operator/factory/vmalert/vmalert_reconcile_test.go b/internal/controller/operator/factory/vmalert/vmalert_reconcile_test.go
index 11444c918a..3679309121 100644
--- a/internal/controller/operator/factory/vmalert/vmalert_reconcile_test.go
+++ b/internal/controller/operator/factory/vmalert/vmalert_reconcile_test.go
@@ -117,8 +117,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
Spec: vmv1beta1.VMAlertSpec{
Datasource: vmv1beta1.VMAlertDatasourceSpec{URL: "http://datasource"},
Notifier: &vmv1beta1.VMAlertNotifierSpec{URL: "http://notifier"},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -145,8 +147,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
Spec: vmv1beta1.VMAlertSpec{
Datasource: vmv1beta1.VMAlertDatasourceSpec{URL: "http://datasource"},
Notifier: &vmv1beta1.VMAlertNotifierSpec{URL: "http://notifier"},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -180,9 +184,11 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
Spec: vmv1beta1.VMAlertSpec{
Datasource: vmv1beta1.VMAlertDatasourceSpec{URL: "http://datasource"},
Notifier: &vmv1beta1.VMAlertNotifierSpec{URL: "http://notifier"},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Paused: true,
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vmalert/vmalert_test.go b/internal/controller/operator/factory/vmalert/vmalert_test.go
index a3059fe49b..0d044952ca 100644
--- a/internal/controller/operator/factory/vmalert/vmalert_test.go
+++ b/internal/controller/operator/factory/vmalert/vmalert_test.go
@@ -741,9 +741,11 @@ func Test_buildVMAlertArgs(t *testing.T) {
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://vmsingle-url",
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ExtraArgs: map[string]string{
- "notifier.url": "http://test",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: map[string]string{
+ "notifier.url": "http://test",
+ },
},
},
},
@@ -771,9 +773,11 @@ func Test_buildVMAlertArgs(t *testing.T) {
},
},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ExtraArgs: map[string]string{
- "notifier.url": "http://test",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: map[string]string{
+ "notifier.url": "http://test",
+ },
},
},
},
diff --git a/internal/controller/operator/factory/vmalertmanager/statefulset.go b/internal/controller/operator/factory/vmalertmanager/statefulset.go
index 3e4cebfb80..60c59c2620 100644
--- a/internal/controller/operator/factory/vmalertmanager/statefulset.go
+++ b/internal/controller/operator/factory/vmalertmanager/statefulset.go
@@ -116,10 +116,7 @@ func buildScrape(cr *vmv1beta1.VMAlertmanager, svc *corev1.Service) *vmv1beta1.V
if cr == nil || svc == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- scrape := build.VMServiceScrape(svc, cr)
- // vmalertmanager always runs with a config-reloader sidecar
- scrape.Spec.Endpoints = append(scrape.Spec.Endpoints, build.ConfigReloaderVMServiceScrapeEndpoint())
- return scrape
+ return build.VMServiceScrape(svc, cr, build.ConfigReloaderScrapeBuilder)
}
func createOrUpdateAlertManagerService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMAlertmanager) error {
diff --git a/internal/controller/operator/factory/vmanomaly/statefulset.go b/internal/controller/operator/factory/vmanomaly/statefulset.go
index 177c74ddd7..970c792323 100644
--- a/internal/controller/operator/factory/vmanomaly/statefulset.go
+++ b/internal/controller/operator/factory/vmanomaly/statefulset.go
@@ -38,7 +38,7 @@ func buildScrape(cr *vmv1.VMAnomaly) *vmv1beta1.VMPodScrape {
if cr == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- return build.VMPodScrape(cr, "monitoring-http")
+ return build.VMPodScrape(cr)
}
// CreateOrUpdate creates vmanomaly and builds config for it
diff --git a/internal/controller/operator/factory/vmauth/vmauth.go b/internal/controller/operator/factory/vmauth/vmauth.go
index 1c459a0cf5..33dc137c64 100644
--- a/internal/controller/operator/factory/vmauth/vmauth.go
+++ b/internal/controller/operator/factory/vmauth/vmauth.go
@@ -33,13 +33,14 @@ import (
)
const (
- vmAuthConfigMountGz = "/opt/vmauth-config-gz"
- vmAuthConfigFolder = "/opt/vmauth"
- vmAuthConfigRawFolder = "/opt/vmauth/config"
- vmAuthConfigName = "config.yaml"
- vmAuthConfigNameGz = "config.yaml.gz"
- vmAuthVolumeName = "config"
- internalPortName = "internal"
+ vmAuthConfigMountGz = "/opt/vmauth-config-gz"
+ vmAuthConfigFolder = "/opt/vmauth"
+ vmAuthConfigRawFolder = "/opt/vmauth/config"
+ vmAuthConfigName = "config.yaml"
+ vmAuthConfigNameGz = "config.yaml.gz"
+ vmAuthVolumeName = "config"
+ internalPortName = "internal"
+ tlsServerConfigMountPath = "/etc/vm/tls-server-secrets"
)
// CreateOrUpdate - handles VMAuth deployment reconciliation.
@@ -147,14 +148,14 @@ func createOrUpdateHTTPRoute(ctx context.Context, rclient client.Client, cr, pre
return nil
}
- newHTTPRoute, err := build.HTTPRoute(cr, cr.Spec.Port, cr.Spec.HTTPRoute)
+ newHTTPRoute, err := build.HTTPRoute(cr, cr.Spec.PrimaryPort(cr.Spec.Port), cr.Spec.HTTPRoute)
if err != nil {
return err
}
var prevHTTPRoute *gwapiv1.HTTPRoute
if prevCr != nil && prevCr.Spec.HTTPRoute != nil {
- prevHTTPRoute, err = build.HTTPRoute(cr, cr.Spec.Port, prevCr.Spec.HTTPRoute)
+ prevHTTPRoute, err = build.HTTPRoute(cr, prevCr.Spec.PrimaryPort(prevCr.Spec.Port), prevCr.Spec.HTTPRoute)
if err != nil {
return err
}
@@ -207,9 +208,6 @@ func makeSpecForVMAuth(cr *vmv1beta1.VMAuth) (*corev1.PodTemplateSpec, error) {
args = append(args, fmt.Sprintf("-auth.config=%s", configPath))
cfg := config.MustGetBaseConfig()
- if cr.Spec.UseProxyProtocol {
- args = append(args, "-httpListenAddr.useProxyProtocol=true")
- }
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -220,7 +218,6 @@ func makeSpecForVMAuth(cr *vmv1beta1.VMAuth) (*corev1.PodTemplateSpec, error) {
args = append(args, fmt.Sprintf("-loggerFormat=%s", cr.Spec.LogFormat))
}
- args = append(args, fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Port))
if len(cr.Spec.InternalListenPort) > 0 {
args = append(args, fmt.Sprintf("-httpInternalListenAddr=:%s", cr.Spec.InternalListenPort))
}
@@ -233,16 +230,6 @@ func makeSpecForVMAuth(cr *vmv1beta1.VMAuth) (*corev1.PodTemplateSpec, error) {
var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(cr.Spec.Port).IntVal})
-
- if len(cr.Spec.InternalListenPort) > 0 {
- ports = append(ports, corev1.ContainerPort{
- Name: internalPortName,
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.InternalListenPort).IntVal,
- })
- }
-
var volumes []corev1.Volume
var volumeMounts []corev1.VolumeMount
var crMounts []corev1.VolumeMount
@@ -345,6 +332,16 @@ func makeSpecForVMAuth(cr *vmv1beta1.VMAuth) (*corev1.PodTemplateSpec, error) {
return nil, fmt.Errorf("cannot apply patch for initContainers: %w", err)
}
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
+ volumes, volumeMounts = build.AddHTTPListenerTLSToVolumes(volumes, volumeMounts, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.HTTPListeners)
+ if len(cr.Spec.InternalListenPort) > 0 {
+ ports = append(ports, corev1.ContainerPort{
+ Name: internalPortName,
+ Protocol: "TCP",
+ ContainerPort: intstr.Parse(cr.Spec.InternalListenPort).IntVal,
+ })
+ }
args = build.AddExtraArgsOverrideDefaults(args, cr.Spec.ExtraArgs, "-")
sort.Strings(args)
@@ -513,7 +510,7 @@ func buildIngressConfig(cr *vmv1beta1.VMAuth) *networkingv1.Ingress {
defaultBackend := networkingv1.IngressBackend{
Service: &networkingv1.IngressServiceBackend{
Name: cr.PrefixedName(),
- Port: networkingv1.ServiceBackendPort{Name: "http"},
+ Port: networkingv1.ServiceBackendPort{Name: cr.Spec.PrimaryPortName()},
},
}
if len(cr.Spec.Ingress.Paths) == 0 {
@@ -577,6 +574,7 @@ func buildIngressConfig(cr *vmv1beta1.VMAuth) *networkingv1.Ingress {
func setInternalSvcPort(cr *vmv1beta1.VMAuth) func(svc *corev1.Service) {
return func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.HTTPListeners)
if len(cr.Spec.InternalListenPort) > 0 {
p := intstr.Parse(cr.Spec.InternalListenPort)
svc.Spec.Ports = append(svc.Spec.Ports, corev1.ServicePort{
@@ -613,8 +611,7 @@ func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevC
return fmt.Errorf("cannot reconcile service for vmauth: %w", err)
}
- // it's not possible to scrape metrics from vmauth if proxyProtocol is configured
- if !ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) && !cr.UseProxyProtocol() {
+ if !ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
svs := buildScrape(cr, svc)
prevSvs := buildScrape(prevCR, prevSvc)
if err := reconcile.VMServiceScrape(ctx, rclient, svs, prevSvs, &owner, false); err != nil {
@@ -706,21 +703,12 @@ func deleteOrphaned(ctx context.Context, rclient client.Client, cr *vmv1beta1.VM
}
func buildScrape(cr *vmv1beta1.VMAuth, svc *corev1.Service) *vmv1beta1.VMServiceScrape {
- if cr == nil || svc == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) || cr.UseProxyProtocol() {
+ if cr == nil || svc == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- b := build.VMServiceScrape(svc, cr)
- if len(cr.Spec.InternalListenPort) > 0 {
- for idx := range b.Spec.Endpoints {
- ep := &b.Spec.Endpoints[idx]
- if ep.Port == "http" {
- ep.Port = internalPortName
- break
- }
- }
- }
+ var sidecars []build.ScrapeBuilder
if cr.HasConfigReloader() {
- b.Spec.Endpoints = append(b.Spec.Endpoints, build.ConfigReloaderVMServiceScrapeEndpoint())
+ sidecars = append(sidecars, build.ConfigReloaderScrapeBuilder)
}
- return b
+ return build.VMServiceScrape(svc, cr, sidecars...)
}
diff --git a/internal/controller/operator/factory/vmauth/vmauth_reconcile_test.go b/internal/controller/operator/factory/vmauth/vmauth_reconcile_test.go
index c62c2c3f78..0e2598594c 100644
--- a/internal/controller/operator/factory/vmauth/vmauth_reconcile_test.go
+++ b/internal/controller/operator/factory/vmauth/vmauth_reconcile_test.go
@@ -114,8 +114,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
cr: &vmv1beta1.VMAuth{
ObjectMeta: objectMeta,
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -139,8 +141,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
cr: &vmv1beta1.VMAuth{
ObjectMeta: objectMeta,
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -175,9 +179,11 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Paused: true,
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vmauth/vmauth_test.go b/internal/controller/operator/factory/vmauth/vmauth_test.go
index 73a21ba2ee..7ff81c4d0f 100644
--- a/internal/controller/operator/factory/vmauth/vmauth_test.go
+++ b/internal/controller/operator/factory/vmauth/vmauth_test.go
@@ -42,6 +42,46 @@ func TestTLSAssetsHash(t *testing.T) {
assert.NotEqual(t, a, d)
}
+func TestBuildScrape(t *testing.T) {
+ svc := &corev1.Service{
+ ObjectMeta: metav1.ObjectMeta{Name: "vmauth-test"},
+ Spec: corev1.ServiceSpec{
+ Ports: []corev1.ServicePort{
+ {Name: "http"},
+ {Name: "internal"},
+ },
+ },
+ }
+ scheme := k8stools.GetTestClientWithObjects(nil).Scheme()
+ build.AddDefaults(scheme)
+
+ // no InternalListenPort: the public "http" listener is scraped
+ // (no config-reloader here, since SecretRef disables it, keeping this focused on port selection)
+ cr := &vmv1beta1.VMAuth{
+ ObjectMeta: metav1.ObjectMeta{Name: "test"},
+ Spec: vmv1beta1.VMAuthSpec{
+ ExternalConfig: vmv1beta1.ExternalConfig{LocalPath: "/etc/vmauth/config.yaml"},
+ },
+ }
+ scheme.Default(cr)
+ scrape := buildScrape(cr, svc)
+ assert.Len(t, scrape.Spec.Endpoints, 1)
+ assert.Equal(t, "http", scrape.Spec.Endpoints[0].Port)
+
+ // InternalListenPort set: the "internal" listener is preferred, "http" is not scraped
+ crInternal := &vmv1beta1.VMAuth{
+ ObjectMeta: metav1.ObjectMeta{Name: "test"},
+ Spec: vmv1beta1.VMAuthSpec{
+ ExternalConfig: vmv1beta1.ExternalConfig{LocalPath: "/etc/vmauth/config.yaml"},
+ InternalListenPort: "8427",
+ },
+ }
+ scheme.Default(crInternal)
+ scrapeInternal := buildScrape(crInternal, svc)
+ assert.Len(t, scrapeInternal.Spec.Endpoints, 1)
+ assert.Equal(t, "internal", scrapeInternal.Spec.Endpoints[0].Port)
+}
+
func TestCreateOrUpdate(t *testing.T) {
type opts struct {
cr *vmv1beta1.VMAuth
@@ -83,8 +123,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Port: "8427",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: "8427",
+ },
},
HTTPRoute: &vmv1beta1.EmbeddedHTTPRoute{
ParentRefs: []gwapiv1.ParentReference{
@@ -136,14 +178,18 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Port: "8427",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: "8427",
+ },
},
},
Status: vmv1beta1.VMAuthStatus{
LastAppliedSpec: &vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Port: "8427",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: "8427",
+ },
},
HTTPRoute: &vmv1beta1.EmbeddedHTTPRoute{
ParentRefs: []gwapiv1.ParentReference{
@@ -517,8 +563,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Port: "8427",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: "8427",
+ },
},
Ingress: &vmv1beta1.EmbeddedIngress{
EmbeddedObjectMetadata: vmv1beta1.EmbeddedObjectMetadata{
@@ -626,13 +674,15 @@ func TestMakeSpecForAuthOk(t *testing.T) {
f(&vmv1beta1.VMAuth{
ObjectMeta: metav1.ObjectMeta{Name: "auth", Namespace: "default"},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- Image: vmv1beta1.Image{
- Repository: "vm-repo",
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ Image: vmv1beta1.Image{
+ Repository: "vm-repo",
+ Tag: "v1.97.1",
+ },
+ Port: "8429",
},
- Port: "8429",
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: "vmcustom:config-reloader-v0.35.0",
@@ -744,13 +794,15 @@ serviceaccountname: vmauth-auth
f(&vmv1beta1.VMAuth{
ObjectMeta: metav1.ObjectMeta{Name: "auth", Namespace: "default"},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- Image: vmv1beta1.Image{
- Repository: "vm-repo",
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ Image: vmv1beta1.Image{
+ Repository: "vm-repo",
+ Tag: "v1.97.1",
+ },
+ Port: "8429",
},
- Port: "8429",
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: "victoriametrics/operator:config-reloader-v0.68.3",
@@ -862,15 +914,17 @@ serviceaccountname: vmauth-auth
f(&vmv1beta1.VMAuth{
ObjectMeta: metav1.ObjectMeta{Name: "auth-tls", Namespace: "default"},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- Image: vmv1beta1.Image{
- Repository: "vm-repo",
- Tag: "v1.97.1",
- },
- Port: "8429",
- ExtraArgs: map[string]string{
- "tls": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ Image: vmv1beta1.Image{
+ Repository: "vm-repo",
+ Tag: "v1.97.1",
+ },
+ Port: "8429",
+ ExtraArgs: map[string]string{
+ "tls": "true",
+ },
},
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
@@ -989,13 +1043,15 @@ func TestBuildIngressForAuthOk(t *testing.T) {
f(&vmv1beta1.VMAuth{
ObjectMeta: metav1.ObjectMeta{Name: "auth", Namespace: "default"},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- Image: vmv1beta1.Image{
- Repository: "vm-repo",
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ Image: vmv1beta1.Image{
+ Repository: "vm-repo",
+ Tag: "v1.97.1",
+ },
+ Port: "8429",
},
- Port: "8429",
},
Ingress: &vmv1beta1.EmbeddedIngress{
Host: "example.com",
@@ -1020,13 +1076,15 @@ rules:
f(&vmv1beta1.VMAuth{
ObjectMeta: metav1.ObjectMeta{Name: "auth", Namespace: "default"},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- Image: vmv1beta1.Image{
- Repository: "vm-repo",
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ Image: vmv1beta1.Image{
+ Repository: "vm-repo",
+ Tag: "v1.97.1",
+ },
+ Port: "8429",
},
- Port: "8429",
},
Ingress: &vmv1beta1.EmbeddedIngress{
Host: "example.com",
diff --git a/internal/controller/operator/factory/vmauth/vmusers_config.go b/internal/controller/operator/factory/vmauth/vmusers_config.go
index 2bc7dbdec5..551d5ca1ed 100644
--- a/internal/controller/operator/factory/vmauth/vmusers_config.go
+++ b/internal/controller/operator/factory/vmauth/vmusers_config.go
@@ -47,13 +47,14 @@ func updateCRDObjURLs(ctx context.Context, rclient client.Client, crd *vmv1beta1
if _, ok := objURLs[key]; ok {
continue
}
- crdObj, ok := crdNameToObject[crd.Kind]
+ newCRDObj, ok := crdNameToObject[crd.Kind]
if !ok {
return fmt.Errorf("unsupported kind=%q", crd.Kind)
}
+ crdObj := newCRDObj()
crdObj.SetName(nsn.Name)
crdObj.SetNamespace(nsn.Namespace)
- url, err := getAsURLObject(ctx, rclient, crdObj, nsn.UseExtraService)
+ url, err := getAsURLObject(ctx, rclient, crdObj, nsn)
if err != nil {
if !build.IsNotFound(err) {
return fmt.Errorf("cannot get object as url: %w", err)
@@ -173,10 +174,10 @@ func createVMUserSecrets(ctx context.Context, rclient client.Client, secrets []*
type objectWithURL interface {
client.Object
- AsURL(isExtra bool) string
+ AsURL(nsn vmv1beta1.NamespacedName) (string, error)
}
-func getAsURLObject(ctx context.Context, rclient client.Client, objT objectWithURL, isExtra bool) (string, error) {
+func getAsURLObject(ctx context.Context, rclient client.Client, objT objectWithURL, nsn vmv1beta1.NamespacedName) (string, error) {
obj := objT.(client.Object)
// dirty hack to restore original type of vmcluster or vlcluster
// since cluster type erased by wrapping it into clusterWithURL
@@ -191,7 +192,12 @@ func getAsURLObject(ctx context.Context, rclient client.Client, objT objectWithU
}
return "", fmt.Errorf("cannot get object by given ref namespace=%q,name=%q: %w", obj.GetNamespace(), obj.GetName(), err)
}
- return objT.AsURL(isExtra), nil
+ rclient.Scheme().Default(obj)
+ url, err := objT.AsURL(nsn)
+ if err != nil {
+ return "", fmt.Errorf("cannot build url for object namespace=%q,name=%q: %w", obj.GetNamespace(), obj.GetName(), err)
+ }
+ return url, nil
}
func (pos *parsedObjects) addAuthCredentialsBuildSecrets(ac *build.AssetsCache) (needToCreateSecrets []*corev1.Secret, needToUpdateSecrets []*corev1.Secret, resultErr error) {
@@ -307,27 +313,27 @@ func injectAuthSettings(secret *corev1.Secret, vmuser *vmv1beta1.VMUser) bool {
return needUpdate
}
-var crdNameToObject = map[string]objectWithURL{
- "VMAgent": &vmv1beta1.VMAgent{},
- "VMAlert": &vmv1beta1.VMAlert{},
- "VMSingle": &vmv1beta1.VMSingle{},
- "VLogs": &vmv1beta1.VLogs{},
+var crdNameToObject = map[string]func() objectWithURL{
+ "VMAgent": func() objectWithURL { return &vmv1beta1.VMAgent{} },
+ "VMAlert": func() objectWithURL { return &vmv1beta1.VMAlert{} },
+ "VMSingle": func() objectWithURL { return &vmv1beta1.VMSingle{} },
+ "VLogs": func() objectWithURL { return &vmv1beta1.VLogs{} },
// keep both variants for backward-compatibility
- "VMAlertmanager": &vmv1beta1.VMAlertmanager{},
- "VMAlertManager": &vmv1beta1.VMAlertmanager{},
- "VMCluster/vmselect": newClusterWithURL("vmselect"),
- "VMCluster/vminsert": newClusterWithURL("vminsert"),
- "VMCluster/vmstorage": newClusterWithURL("vmstorage"),
- "VMAnomaly": &vmv1.VMAnomaly{},
- "VLSingle": &vmv1.VLSingle{},
- "VLCluster/vlselect": newClusterWithURL("vlselect"),
- "VLCluster/vlinsert": newClusterWithURL("vlinsert"),
- "VLCluster/vlstorage": newClusterWithURL("vlstorage"),
- "VLAgent": &vmv1.VLAgent{},
- "VTSingle": &vmv1.VTSingle{},
- "VTCluster/vtselect": newClusterWithURL("vtselect"),
- "VTCluster/vtinsert": newClusterWithURL("vtinsert"),
- "VTCluster/vtstorage": newClusterWithURL("vtstorage"),
+ "VMAlertmanager": func() objectWithURL { return &vmv1beta1.VMAlertmanager{} },
+ "VMAlertManager": func() objectWithURL { return &vmv1beta1.VMAlertmanager{} },
+ "VMCluster/vmselect": func() objectWithURL { return newClusterWithURL("vmselect") },
+ "VMCluster/vminsert": func() objectWithURL { return newClusterWithURL("vminsert") },
+ "VMCluster/vmstorage": func() objectWithURL { return newClusterWithURL("vmstorage") },
+ "VMAnomaly": func() objectWithURL { return &vmv1.VMAnomaly{} },
+ "VLSingle": func() objectWithURL { return &vmv1.VLSingle{} },
+ "VLCluster/vlselect": func() objectWithURL { return newClusterWithURL("vlselect") },
+ "VLCluster/vlinsert": func() objectWithURL { return newClusterWithURL("vlinsert") },
+ "VLCluster/vlstorage": func() objectWithURL { return newClusterWithURL("vlstorage") },
+ "VLAgent": func() objectWithURL { return &vmv1.VLAgent{} },
+ "VTSingle": func() objectWithURL { return &vmv1.VTSingle{} },
+ "VTCluster/vtselect": func() objectWithURL { return newClusterWithURL("vtselect") },
+ "VTCluster/vtinsert": func() objectWithURL { return newClusterWithURL("vtinsert") },
+ "VTCluster/vtstorage": func() objectWithURL { return newClusterWithURL("vtstorage") },
}
// helper interface to restore VMCluster type
@@ -335,33 +341,33 @@ type unwrapObject interface {
origin() client.Object
}
-var clusterComponentToURL = map[string]func(obj client.Object, isExtra bool) string{
- "vminsert": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1beta1.VMCluster).AsURL(vmv1beta1.ClusterComponentInsert, isExtra)
+var clusterComponentToURL = map[string]func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error){
+ "vminsert": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1beta1.VMCluster).AsURL(vmv1beta1.ClusterComponentInsert, nsn)
},
- "vmselect": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1beta1.VMCluster).AsURL(vmv1beta1.ClusterComponentSelect, isExtra)
+ "vmselect": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1beta1.VMCluster).AsURL(vmv1beta1.ClusterComponentSelect, nsn)
},
- "vmstorage": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1beta1.VMCluster).AsURL(vmv1beta1.ClusterComponentStorage, isExtra)
+ "vmstorage": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1beta1.VMCluster).AsURL(vmv1beta1.ClusterComponentStorage, nsn)
},
- "vlinsert": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1.VLCluster).AsURL(vmv1beta1.ClusterComponentInsert, isExtra)
+ "vlinsert": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1.VLCluster).AsURL(vmv1beta1.ClusterComponentInsert, nsn)
},
- "vlselect": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1.VLCluster).AsURL(vmv1beta1.ClusterComponentSelect, isExtra)
+ "vlselect": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1.VLCluster).AsURL(vmv1beta1.ClusterComponentSelect, nsn)
},
- "vlstorage": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1.VLCluster).AsURL(vmv1beta1.ClusterComponentStorage, isExtra)
+ "vlstorage": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1.VLCluster).AsURL(vmv1beta1.ClusterComponentStorage, nsn)
},
- "vtinsert": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1.VTCluster).AsURL(vmv1beta1.ClusterComponentInsert, isExtra)
+ "vtinsert": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1.VTCluster).AsURL(vmv1beta1.ClusterComponentInsert, nsn)
},
- "vtselect": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1.VTCluster).AsURL(vmv1beta1.ClusterComponentSelect, isExtra)
+ "vtselect": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1.VTCluster).AsURL(vmv1beta1.ClusterComponentSelect, nsn)
},
- "vtstorage": func(obj client.Object, isExtra bool) string {
- return obj.(*vmv1.VTCluster).AsURL(vmv1beta1.ClusterComponentStorage, isExtra)
+ "vtstorage": func(obj client.Object, nsn vmv1beta1.NamespacedName) (string, error) {
+ return obj.(*vmv1.VTCluster).AsURL(vmv1beta1.ClusterComponentStorage, nsn)
},
}
@@ -391,12 +397,12 @@ func (c *clusterWithURL) origin() client.Object {
}
// AsURL implements AsURL interface
-func (c *clusterWithURL) AsURL(isExtra bool) string {
+func (c *clusterWithURL) AsURL(nsn vmv1beta1.NamespacedName) (string, error) {
builder, ok := clusterComponentToURL[c.component]
if !ok {
panic(fmt.Sprintf("BUG: not expected component=%q for clusterWithURL object", c.component))
}
- return builder(c.Object, isExtra)
+ return builder(c.Object, nsn)
}
// generateVMAuthConfig create VMAuth cfg for given Users.
diff --git a/internal/controller/operator/factory/vmauth/vmusers_config_test.go b/internal/controller/operator/factory/vmauth/vmusers_config_test.go
index 17d1099da1..897c9e9c7f 100644
--- a/internal/controller/operator/factory/vmauth/vmusers_config_test.go
+++ b/internal/controller/operator/factory/vmauth/vmusers_config_test.go
@@ -16,6 +16,7 @@ import (
vmv1 "github.com/VictoriaMetrics/operator/api/operator/v1"
vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
+ "github.com/VictoriaMetrics/operator/internal/controller/operator/factory/build"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/k8stools"
)
@@ -76,8 +77,8 @@ func Test_genUserCfg(t *testing.T) {
},
},
objURLs: map[string]string{
- "VMCluster/vminsert/monitoring/vminsert": "http://vminsert.monitoring.svc:8481",
- "VMCluster/vmselect/monitoring/vmselect": "http://vmselect.monitoring.svc:8482",
+ "VMCluster/vminsert/monitoring/vminsert/": "http://vminsert.monitoring.svc:8481",
+ "VMCluster/vmselect/monitoring/vmselect/": "http://vmselect.monitoring.svc:8482",
},
want: `url_map:
- url_prefix:
@@ -155,8 +156,8 @@ bearer_token: secret-token
},
},
objURLs: map[string]string{
- "VMCluster/vminsert/monitoring/vminsert": "http://vminsert.monitoring.svc:8481",
- "VMCluster/vmselect/monitoring/vmselect": "http://vmselect.monitoring.svc:8482",
+ "VMCluster/vminsert/monitoring/vminsert/": "http://vminsert.monitoring.svc:8481",
+ "VMCluster/vmselect/monitoring/vmselect/": "http://vmselect.monitoring.svc:8482",
},
want: `url_map:
- url_prefix:
@@ -203,8 +204,8 @@ bearer_token: secret-token
},
},
objURLs: map[string]string{
- "VMCluster/vminsert/monitoring/vminsert": "http://vminsert.monitoring.svc:8481",
- "VMCluster/vmselect/monitoring/vmselect": "http://vmselect.monitoring.svc:8482",
+ "VMCluster/vminsert/monitoring/vminsert/": "http://vminsert.monitoring.svc:8481",
+ "VMCluster/vmselect/monitoring/vmselect/": "http://vmselect.monitoring.svc:8482",
},
want: `url_map:
- url_prefix:
@@ -287,8 +288,8 @@ password: pass
},
},
objURLs: map[string]string{
- "VMAgent/monitoring/base": "http://vmagent-base.monitoring.svc:8429",
- "VMSingle/monitoring/db": "http://vmsingle-b.monitoring.svc:8429",
+ "VMAgent/monitoring/base/": "http://vmagent-base.monitoring.svc:8429",
+ "VMSingle/monitoring/db/": "http://vmsingle-b.monitoring.svc:8429",
},
want: `url_map:
- url_prefix:
@@ -360,9 +361,9 @@ bearer_token: secret-token
},
},
objURLs: map[string]string{
- "VMAgent/monitoring/base": "http://vmagent-base.monitoring.svc:8429",
- "VMSingle/monitoring/db": "http://vmsingle-b.monitoring.svc:8429",
- "VLogs/monitoring/db": "http://vlogs-b.monitoring.svc:8482",
+ "VMAgent/monitoring/base/": "http://vmagent-base.monitoring.svc:8429",
+ "VMSingle/monitoring/db/": "http://vmsingle-b.monitoring.svc:8429",
+ "VLogs/monitoring/db/": "http://vlogs-b.monitoring.svc:8482",
},
want: `url_map:
- url_prefix:
@@ -409,8 +410,8 @@ bearer_token: secret-token
},
},
objURLs: map[string]string{
- "VMAgent/monitoring/base": "http://vmagent-base.monitoring.svc:8429",
- "VMSingle/monitoring/db": "http://vmsingle-b.monitoring.svc:8429",
+ "VMAgent/monitoring/base/": "http://vmagent-base.monitoring.svc:8429",
+ "VMSingle/monitoring/db/": "http://vmsingle-b.monitoring.svc:8429",
},
want: `url_prefix:
- http://vmagent-base.monitoring.svc:8429
@@ -442,8 +443,8 @@ bearer_token: secret-token
},
},
objURLs: map[string]string{
- "VMAgent/monitoring/base": "http://vmagent-base.monitoring.svc:8429",
- "VMSingle/monitoring/db": "http://vmsingle-b.monitoring.svc:8429",
+ "VMAgent/monitoring/base/": "http://vmagent-base.monitoring.svc:8429",
+ "VMSingle/monitoring/db/": "http://vmsingle-b.monitoring.svc:8429",
},
want: `url_prefix:
- http://vmagent-base.monitoring.svc:8429
@@ -740,11 +741,11 @@ password: pass
},
},
objURLs: map[string]string{
- "VLAgent/monitoring/collector": "http://vlagent-base.monitoring.svc:9429",
- "VLSingle/monitoring/db": "http://vlsingle-db.monitoring.svc:9428",
- "VLCluster/vlinsert/monitoring/main-cluster": "http://vlinsert-main-cluster.monitoring.svc:9401",
- "VLCluster/vlselect/monitoring/main-cluster": "http://vlselect-main-cluster.monitoring.svc:9401",
- "VLCluster/vlstorage/monitoring/main-cluster": "http://vlstorage-main-cluster.monitoring.svc:9401",
+ "VLAgent/monitoring/collector/": "http://vlagent-base.monitoring.svc:9429",
+ "VLSingle/monitoring/db/": "http://vlsingle-db.monitoring.svc:9428",
+ "VLCluster/vlinsert/monitoring/main-cluster/": "http://vlinsert-main-cluster.monitoring.svc:9401",
+ "VLCluster/vlselect/monitoring/main-cluster/": "http://vlselect-main-cluster.monitoring.svc:9401",
+ "VLCluster/vlstorage/monitoring/main-cluster/": "http://vlstorage-main-cluster.monitoring.svc:9401",
},
want: `url_map:
- url_prefix:
@@ -1088,9 +1089,14 @@ func Test_buildConfig(t *testing.T) {
want string
predefinedObjects []runtime.Object
}
+ scheme := k8stools.GetTestClientWithObjects(nil).Scheme()
+ build.AddDefaults(scheme)
f := func(o opts) {
t.Helper()
ctx := context.TODO()
+ for _, obj := range o.predefinedObjects {
+ scheme.Default(obj)
+ }
rand.Shuffle(len(o.predefinedObjects), func(i, j int) {
o.predefinedObjects[i], o.predefinedObjects[j] = o.predefinedObjects[j], o.predefinedObjects[i]
})
@@ -2470,13 +2476,17 @@ unauthorized_user:
},
Spec: vmv1beta1.VMClusterSpec{
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(10)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(10)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(5)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(5)),
+ },
},
},
},
@@ -3248,7 +3258,7 @@ unauthorized_user:
},
want: `users:
- url_prefix:
- - http://vmsingle-test-additional-service.default.svc:8428
+ - http://vmsingle-test-additional-service.default.svc:8429
bearer_token: bearer
`,
})
diff --git a/internal/controller/operator/factory/vmcluster/vmcluster.go b/internal/controller/operator/factory/vmcluster/vmcluster.go
index 9c449b8834..7b45ec42fd 100644
--- a/internal/controller/operator/factory/vmcluster/vmcluster.go
+++ b/internal/controller/operator/factory/vmcluster/vmcluster.go
@@ -28,6 +28,8 @@ import (
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/reconcile"
)
+const tlsServerConfigMountPath = "/etc/vm/tls-server-secrets"
+
// CreateOrUpdate reconciled cluster object with order
// first we check status of vmStorage and waiting for its readiness
// then vmSelect and wait for it readiness as well
@@ -63,11 +65,11 @@ func CreateOrUpdate(ctx context.Context, cr *vmv1beta1.VMCluster, rclient client
}
owner := cr.AsOwner()
if cr.IsOwnsServiceAccount() {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
sa := build.ServiceAccount(b)
var prevSA *corev1.ServiceAccount
if prevCR != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentRoot)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentRoot)
prevSA = build.ServiceAccount(b)
}
if err := reconcile.ServiceAccount(ctx, rclient, sa, prevSA, &owner); err != nil {
@@ -198,8 +200,9 @@ func createOrUpdateVMSelect(ctx context.Context, rclient client.Client, cr, prev
}
func buildVMSelectService(cr *vmv1beta1.VMCluster) *corev1.Service {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
- svc := build.Service(b, cr.Spec.VMSelect.Port, func(svc *corev1.Service) {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ svc := build.Service(b, cr.Spec.VMSelect.PrimaryPort(cr.Spec.VMSelect.Port), func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.VMSelect.HTTPListeners)
svc.Spec.ClusterIP = "None"
svc.Spec.PublishNotReadyAddresses = true
if cr.Spec.VMSelect.ClusterNativePort != "" {
@@ -227,6 +230,9 @@ func buildVMSelectScrape(cr *vmv1beta1.VMCluster, svc *corev1.Service) *vmv1beta
return nil
}
svs := build.VMServiceScrape(svc, cr.Spec.VMSelect)
+ if svs == nil {
+ return nil
+ }
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableSelectBalancing {
svs.Spec.JobLabel = vmv1beta1.VMAuthLBServiceProxyJobNameLabel
}
@@ -263,10 +269,10 @@ func createOrUpdateVMSelectService(ctx context.Context, rclient client.Client, c
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableSelectBalancing {
var prevPort string
if prevCR != nil && prevCR.Spec.VMSelect != nil {
- prevPort = prevCR.Spec.VMSelect.Port
+ prevPort = prevCR.Spec.VMSelect.PrimaryPort(prevCR.Spec.VMSelect.Port)
}
kind := vmv1beta1.ClusterComponentSelect
- if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.VMSelect.Port, prevPort); err != nil {
+ if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.VMSelect.PrimaryPort(cr.Spec.VMSelect.Port), prevPort); err != nil {
return fmt.Errorf("cannot create lb svc for vmselect: %w", err)
}
}
@@ -285,6 +291,9 @@ func buildVMAuthScrape(cr *vmv1beta1.VMCluster, svc *corev1.Service) *vmv1beta1.
return nil
}
svs := build.VMServiceScrape(svc, &cr.Spec.RequestsLoadBalancer.Spec)
+ if svs == nil {
+ return nil
+ }
if svs.Spec.Selector.MatchLabels == nil {
svs.Spec.Selector.MatchLabels = make(map[string]string)
}
@@ -294,8 +303,8 @@ func buildVMAuthScrape(cr *vmv1beta1.VMCluster, svc *corev1.Service) *vmv1beta1.
// createOrUpdateLBProxyService builds vminsert and vmselect external services to expose vmcluster components for access by vmauth
func createOrUpdateLBProxyService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster, kind vmv1beta1.ClusterComponent, port, prevPort string) error {
- builder := func(r *vmv1beta1.VMCluster) *build.ChildBuilder {
- b := build.NewChildBuilder(r, kind)
+ builder := func(r *vmv1beta1.VMCluster) *vmv1beta1.ChildBuilder {
+ b := vmv1beta1.NewChildBuilder(r, kind)
b.SetFinalLabels(labels.Merge(b.FinalLabels(), map[string]string{
vmv1beta1.VMAuthLBServiceProxyTargetLabel: string(kind),
}))
@@ -348,8 +357,9 @@ func createOrUpdateVMInsert(ctx context.Context, rclient client.Client, cr, prev
}
func buildVMInsertService(cr *vmv1beta1.VMCluster) *corev1.Service {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
- svc := build.Service(b, cr.Spec.VMInsert.Port, func(svc *corev1.Service) {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ svc := build.Service(b, cr.Spec.VMInsert.PrimaryPort(cr.Spec.VMInsert.Port), func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.VMInsert.HTTPListeners)
build.AppendInsertPortsToService(cr.Spec.VMInsert.InsertPorts, svc)
if cr.Spec.VMInsert.ClusterNativePort != "" {
svc.Spec.Ports = append(svc.Spec.Ports,
@@ -375,6 +385,9 @@ func buildVMInsertScrape(cr *vmv1beta1.VMCluster, svc *corev1.Service) *vmv1beta
return nil
}
svs := build.VMServiceScrape(svc, cr.Spec.VMInsert)
+ if svs == nil {
+ return nil
+ }
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableInsertBalancing {
svs.Spec.JobLabel = vmv1beta1.VMAuthLBServiceProxyJobNameLabel
}
@@ -414,10 +427,10 @@ func createOrUpdateVMInsertService(ctx context.Context, rclient client.Client, c
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableInsertBalancing {
var prevPort string
if prevCR != nil && prevCR.Spec.VMInsert != nil {
- prevPort = prevCR.Spec.VMInsert.Port
+ prevPort = prevCR.Spec.VMInsert.PrimaryPort(prevCR.Spec.VMInsert.Port)
}
kind := vmv1beta1.ClusterComponentInsert
- if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.VMInsert.Port, prevPort); err != nil {
+ if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.VMInsert.PrimaryPort(cr.Spec.VMInsert.Port), prevPort); err != nil {
return fmt.Errorf("cannot create lb svc for vminsert: %w", err)
}
}
@@ -461,8 +474,9 @@ func createOrUpdateVMStorage(ctx context.Context, rclient client.Client, cr, pre
}
func buildVMStorageService(cr *vmv1beta1.VMCluster) *corev1.Service {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
- return build.Service(b, cr.Spec.VMStorage.Port, func(svc *corev1.Service) {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ return build.Service(b, cr.Spec.VMStorage.PrimaryPort(cr.Spec.VMStorage.Port), func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.VMStorage.HTTPListeners)
svc.Spec.ClusterIP = "None"
svc.Spec.PublishNotReadyAddresses = true
svc.Spec.Ports = append(svc.Spec.Ports, []corev1.ServicePort{
@@ -495,7 +509,11 @@ func buildVMStorageScrape(cr *vmv1beta1.VMCluster, svc *corev1.Service) *vmv1bet
if cr == nil || svc == nil || cr.Spec.VMStorage == nil || ptr.Deref(cr.Spec.VMStorage.DisableSelfServiceScrape, false) {
return nil
}
- return build.VMServiceScrape(svc, cr.Spec.VMStorage, "vmbackupmanager")
+ var sidecars []build.ScrapeBuilder
+ if cr.Spec.VMStorage.VMBackup != nil {
+ sidecars = append(sidecars, cr.Spec.VMStorage.VMBackup)
+ }
+ return build.VMServiceScrape(svc, cr.Spec.VMStorage, sidecars...)
}
func createOrUpdateVMStorageService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
@@ -574,9 +592,7 @@ func genVMSelectSpec(cr *vmv1beta1.VMCluster) (*appsv1.StatefulSet, error) {
func makePodSpecForVMSelect(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, error) {
commonName := cr.PrefixedName(vmv1beta1.ClusterComponentSelect)
cfg := config.MustGetBaseConfig()
- args := []string{
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.VMSelect.Port),
- }
+ var args []string
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -652,8 +668,9 @@ func makePodSpecForVMSelect(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, e
if cr.Spec.VMSelect.HPA == nil && cr.Spec.VMSelect.ReplicaCount != nil {
selectNodeFlag := build.NewFlag("-selectNode", "")
vmselectCount := *cr.Spec.VMSelect.ReplicaCount
+ selectPort := cr.Spec.VMSelect.PrimaryPort(cr.Spec.VMSelect.Port)
for idx := int32(0); idx < vmselectCount; idx++ {
- selectNodeFlag.Add(vmv1beta1.PodDNSAddress(commonName, idx, cr.Namespace, cr.Spec.VMSelect.Port, cr.Spec.ClusterDomainName), int(idx))
+ selectNodeFlag.Add(vmv1beta1.PodDNSAddress(commonName, idx, cr.Namespace, selectPort, cr.Spec.ClusterDomainName), int(idx))
}
args = build.AppendFlagsToArgs(args, int(vmselectCount), selectNodeFlag)
}
@@ -665,8 +682,7 @@ func makePodSpecForVMSelect(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, e
var envs []corev1.EnvVar
envs = append(envs, cr.Spec.VMSelect.ExtraEnvs...)
- var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(cr.Spec.VMSelect.Port).IntVal})
+ ports := build.AddHTTPListenerPortsTo(nil, cr.Spec.VMSelect.HTTPListeners)
if cr.Spec.VMSelect.ClusterNativePort != "" {
ports = append(ports, corev1.ContainerPort{Name: "clusternative", Protocol: "TCP", ContainerPort: intstr.Parse(cr.Spec.VMSelect.ClusterNativePort).IntVal})
}
@@ -722,7 +738,8 @@ func makePodSpecForVMSelect(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, e
volumes, vmMounts = build.LicenseVolumeTo(volumes, vmMounts, cr.Spec.License, vmv1beta1.SecretsDir)
args = build.LicenseArgsTo(args, cr.Spec.License, vmv1beta1.SecretsDir)
-
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.VMSelect.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.VMSelect.HTTPListeners, tlsServerConfigMountPath)
args = build.AddExtraArgsOverrideDefaults(args, cr.Spec.VMSelect.ExtraArgs, "-")
sort.Strings(args)
vmselectContainer := corev1.Container{
@@ -775,11 +792,11 @@ func makePodSpecForVMSelect(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, e
}
func createOrUpdatePodDisruptionBudgetForVMSelect(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
pdb := build.PodDisruptionBudget(b, cr.Spec.VMSelect.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.VMSelect.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.VMSelect.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -787,11 +804,11 @@ func createOrUpdatePodDisruptionBudgetForVMSelect(ctx context.Context, rclient c
}
func createOrUpdateNetworkPolicyForVMSelect(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
np := build.NetworkPolicy(b, cr.Spec.VMSelect.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.VMSelect != nil && prevCR.Spec.VMSelect.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevNP = build.NetworkPolicy(b, prevCR.Spec.VMSelect.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -838,9 +855,7 @@ func genVMInsertSpec(cr *vmv1beta1.VMCluster) (*appsv1.Deployment, error) {
func makePodSpecForVMInsert(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, error) {
cfg := config.MustGetBaseConfig()
- args := []string{
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.VMInsert.Port),
- }
+ var args []string
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -885,13 +900,7 @@ func makePodSpecForVMInsert(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, e
envs = append(envs, cr.Spec.VMInsert.ExtraEnvs...)
- ports := []corev1.ContainerPort{
- {
- Name: "http",
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.VMInsert.Port).IntVal,
- },
- }
+ ports := build.AddHTTPListenerPortsTo(nil, cr.Spec.VMInsert.HTTPListeners)
ports = build.AppendInsertPorts(ports, cr.Spec.VMInsert.InsertPorts)
if cr.Spec.VMInsert.ClusterNativePort != "" {
ports = append(ports,
@@ -946,7 +955,8 @@ func makePodSpecForVMInsert(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, e
}
volumes, vmMounts = build.LicenseVolumeTo(volumes, vmMounts, cr.Spec.License, vmv1beta1.SecretsDir)
args = build.LicenseArgsTo(args, cr.Spec.License, vmv1beta1.SecretsDir)
-
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.VMInsert.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.VMInsert.HTTPListeners, tlsServerConfigMountPath)
args = build.AddExtraArgsOverrideDefaults(args, cr.Spec.VMInsert.ExtraArgs, "-")
sort.Strings(args)
@@ -998,11 +1008,11 @@ func makePodSpecForVMInsert(cr *vmv1beta1.VMCluster) (*corev1.PodTemplateSpec, e
}
func createOrUpdatePodDisruptionBudgetForVMInsert(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
pdb := build.PodDisruptionBudget(b, cr.Spec.VMInsert.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.VMInsert.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.VMInsert.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -1010,11 +1020,11 @@ func createOrUpdatePodDisruptionBudgetForVMInsert(ctx context.Context, rclient c
}
func createOrUpdateNetworkPolicyForVMInsert(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
np := build.NetworkPolicy(b, cr.Spec.VMInsert.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.VMInsert != nil && prevCR.Spec.VMInsert.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevNP = build.NetworkPolicy(b, prevCR.Spec.VMInsert.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -1066,7 +1076,6 @@ func makePodSpecForVMStorage(ctx context.Context, cr *vmv1beta1.VMCluster) (*cor
args := []string{
fmt.Sprintf("-vminsertAddr=:%s", cr.Spec.VMStorage.VMInsertPort),
fmt.Sprintf("-vmselectAddr=:%s", cr.Spec.VMStorage.VMSelectPort),
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.VMStorage.Port),
}
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
@@ -1123,23 +1132,19 @@ func makePodSpecForVMStorage(ctx context.Context, cr *vmv1beta1.VMCluster) (*cor
envs = append(envs, cr.Spec.VMStorage.ExtraEnvs...)
- ports := []corev1.ContainerPort{
- {
- Name: "http",
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.VMStorage.Port).IntVal,
- },
- {
+ ports := build.AddHTTPListenerPortsTo(nil, cr.Spec.VMStorage.HTTPListeners)
+ ports = append(ports,
+ corev1.ContainerPort{
Name: "vminsert",
Protocol: "TCP",
ContainerPort: intstr.Parse(cr.Spec.VMStorage.VMInsertPort).IntVal,
},
- {
+ corev1.ContainerPort{
Name: "vmselect",
Protocol: "TCP",
ContainerPort: intstr.Parse(cr.Spec.VMStorage.VMSelectPort).IntVal,
},
- }
+ )
volumes := make([]corev1.Volume, 0)
volumes = append(volumes, cr.Spec.VMStorage.Volumes...)
@@ -1202,7 +1207,8 @@ func makePodSpecForVMStorage(ctx context.Context, cr *vmv1beta1.VMCluster) (*cor
volumes, vmMounts = build.LicenseVolumeTo(volumes, vmMounts, cr.Spec.License, vmv1beta1.SecretsDir)
args = build.LicenseArgsTo(args, cr.Spec.License, vmv1beta1.SecretsDir)
-
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.VMStorage.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.VMStorage.HTTPListeners, tlsServerConfigMountPath)
args = build.AddExtraArgsOverrideDefaults(args, cr.Spec.VMStorage.ExtraArgs, "-")
sort.Strings(args)
vmstorageContainer := corev1.Container{
@@ -1224,7 +1230,7 @@ func makePodSpecForVMStorage(ctx context.Context, cr *vmv1beta1.VMCluster) (*cor
var initContainers []corev1.Container
if cr.Spec.VMStorage.VMBackup != nil {
- vmBackupManagerContainer, err := build.VMBackupManager(ctx, cr.Spec.VMStorage.VMBackup, cr.Spec.VMStorage.Port, cr.Spec.VMStorage.StorageDataPath, commonMounts, cr.Spec.VMStorage.ExtraArgs, true, cr.Spec.License)
+ vmBackupManagerContainer, err := build.VMBackupManager(ctx, cr, cr.Spec.VMStorage.StorageDataPath, commonMounts, true, cr.Spec.License)
if err != nil {
return nil, err
}
@@ -1280,11 +1286,11 @@ func makePodSpecForVMStorage(ctx context.Context, cr *vmv1beta1.VMCluster) (*cor
}
func createOrUpdatePodDisruptionBudgetForVMStorage(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
pdb := build.PodDisruptionBudget(b, cr.Spec.VMStorage.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.VMStorage.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.VMStorage.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -1292,11 +1298,11 @@ func createOrUpdatePodDisruptionBudgetForVMStorage(ctx context.Context, rclient
}
func createOrUpdateNetworkPolicyForVMStorage(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
np := build.NetworkPolicy(b, cr.Spec.VMStorage.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.VMStorage != nil && prevCR.Spec.VMStorage.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevNP = build.NetworkPolicy(b, prevCR.Spec.VMStorage.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -1307,7 +1313,7 @@ func createOrUpdateVMInsertHPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.VMInsert.HPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
targetRef := autoscalingv2.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -1316,7 +1322,7 @@ func createOrUpdateVMInsertHPA(ctx context.Context, rclient client.Client, cr, p
newHPA := build.HPA(b, targetRef, cr.Spec.VMInsert.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.VMInsert.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.VMInsert.HPA)
}
owner := cr.AsOwner()
@@ -1327,7 +1333,7 @@ func createOrUpdateVMSelectHPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.VMSelect.HPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
targetRef := autoscalingv2.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "StatefulSet",
@@ -1336,7 +1342,7 @@ func createOrUpdateVMSelectHPA(ctx context.Context, rclient client.Client, cr, p
defaultHPA := build.HPA(b, targetRef, cr.Spec.VMSelect.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.VMSelect.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.VMSelect.HPA)
}
owner := cr.AsOwner()
@@ -1348,7 +1354,7 @@ func createOrUpdateVMStorageHPA(ctx context.Context, rclient client.Client, cr,
if hpa == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
targetRef := autoscalingv2.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "StatefulSet",
@@ -1357,7 +1363,7 @@ func createOrUpdateVMStorageHPA(ctx context.Context, rclient client.Client, cr,
defaultHPA := build.HPA(b, targetRef, hpa)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.VMStorage.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.VMStorage.HPA)
}
owner := cr.AsOwner()
@@ -1368,7 +1374,7 @@ func createOrUpdateVMInsertVPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.VMInsert.VPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -1377,7 +1383,7 @@ func createOrUpdateVMInsertVPA(ctx context.Context, rclient client.Client, cr, p
newVPA := build.VPA(b, targetRef, cr.Spec.VMInsert.VPA)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.VMInsert != nil && prevCR.Spec.VMInsert.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.VMInsert.VPA)
}
owner := cr.AsOwner()
@@ -1388,7 +1394,7 @@ func createOrUpdateVMSelectVPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.VMSelect.VPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "StatefulSet",
@@ -1397,7 +1403,7 @@ func createOrUpdateVMSelectVPA(ctx context.Context, rclient client.Client, cr, p
newVPA := build.VPA(b, targetRef, cr.Spec.VMSelect.VPA)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.VMSelect != nil && prevCR.Spec.VMSelect.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.VMSelect.VPA)
}
owner := cr.AsOwner()
@@ -1409,7 +1415,7 @@ func createOrUpdateVMStorageVPA(ctx context.Context, rclient client.Client, cr,
if vpa == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "StatefulSet",
@@ -1418,7 +1424,7 @@ func createOrUpdateVMStorageVPA(ctx context.Context, rclient client.Client, cr,
newVPA := build.VPA(b, targetRef, vpa)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.VMStorage != nil && prevCR.Spec.VMStorage.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.VMStorage.VPA)
}
owner := cr.AsOwner()
@@ -1546,7 +1552,7 @@ func deleteOrphaned(ctx context.Context, rclient client.Client, cr *vmv1beta1.VM
}
}
if !cr.IsOwnsServiceAccount() {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
objMeta := metav1.ObjectMeta{Name: b.PrefixedName(), Namespace: b.GetNamespace()}
objsToRemove := []client.Object{&corev1.ServiceAccount{ObjectMeta: objMeta}}
if err := finalize.SafeDeleteWithFinalizer(ctx, rclient, objsToRemove, b); err != nil {
@@ -1576,13 +1582,13 @@ func buildVMAuthLBSecret(cr *vmv1beta1.VMCluster) *corev1.Secret {
insertProto := "http"
selectProto := "http"
if cr.Spec.VMSelect != nil {
- selectPort = cr.Spec.VMSelect.Port
+ selectPort = cr.Spec.VMSelect.PrimaryPort(cr.Spec.VMSelect.Port)
if cr.Spec.VMSelect.UseTLS() {
selectProto = "https"
}
}
if cr.Spec.VMInsert != nil {
- insertPort = cr.Spec.VMInsert.Port
+ insertPort = cr.Spec.VMInsert.PrimaryPort(cr.Spec.VMInsert.Port)
if cr.Spec.VMInsert.UseTLS() {
insertProto = "https"
}
@@ -1726,8 +1732,8 @@ func buildVMAuthLBDeployment(cr *vmv1beta1.VMCluster) (*appsv1.Deployment, error
}
func createOrUpdateVMAuthLBService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- builder := func(r *vmv1beta1.VMCluster) *build.ChildBuilder {
- b := build.NewChildBuilder(r, vmv1beta1.ClusterComponentBalancer)
+ builder := func(r *vmv1beta1.VMCluster) *vmv1beta1.ChildBuilder {
+ b := vmv1beta1.NewChildBuilder(r, vmv1beta1.ClusterComponentBalancer)
b.SetFinalLabels(labels.Merge(b.FinalLabels(), map[string]string{
vmv1beta1.VMAuthLBServiceProxyTargetLabel: "vmauth",
}))
@@ -1808,7 +1814,7 @@ func createOrUpdateVMAuthLBHPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.RequestsLoadBalancer.Spec.HPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
targetRef := autoscalingv2.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -1817,7 +1823,7 @@ func createOrUpdateVMAuthLBHPA(ctx context.Context, rclient client.Client, cr, p
newHPA := build.HPA(b, targetRef, cr.Spec.RequestsLoadBalancer.Spec.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.RequestsLoadBalancer.Spec.HPA)
}
owner := cr.AsOwner()
@@ -1834,11 +1840,11 @@ func storageNodeSRVAddr(svcName, namespace, port, clusterDomain string) string {
}
func createOrUpdatePodDisruptionBudgetForVMAuthLB(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
pdb := build.PodDisruptionBudget(b, cr.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -1846,11 +1852,11 @@ func createOrUpdatePodDisruptionBudgetForVMAuthLB(ctx context.Context, rclient c
}
func createOrUpdateNetworkPolicyForVMAuthLB(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
np := build.NetworkPolicy(b, cr.Spec.RequestsLoadBalancer.Spec.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevNP = build.NetworkPolicy(b, prevCR.Spec.RequestsLoadBalancer.Spec.NetworkPolicy)
}
owner := cr.AsOwner()
diff --git a/internal/controller/operator/factory/vmcluster/vmcluster_reconcile_test.go b/internal/controller/operator/factory/vmcluster/vmcluster_reconcile_test.go
index a56725427e..247f138427 100644
--- a/internal/controller/operator/factory/vmcluster/vmcluster_reconcile_test.go
+++ b/internal/controller/operator/factory/vmcluster/vmcluster_reconcile_test.go
@@ -80,18 +80,24 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -268,8 +274,10 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Paused: true,
@@ -326,13 +334,25 @@ func TestCreateOrUpdate_LBDeploymentWithHPA(t *testing.T) {
},
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vmcluster/vmcluster_test.go b/internal/controller/operator/factory/vmcluster/vmcluster_test.go
index 33f3d57dea..7922aacd9b 100644
--- a/internal/controller/operator/factory/vmcluster/vmcluster_test.go
+++ b/internal/controller/operator/factory/vmcluster/vmcluster_test.go
@@ -76,8 +76,10 @@ func TestCreateOrUpdate(t *testing.T) {
PodMetadata: &vmv1beta1.EmbeddedObjectMetadata{
Annotations: map[string]string{"key": "value"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
},
VMStorage: &vmv1beta1.VMStorage{
@@ -85,17 +87,21 @@ func TestCreateOrUpdate(t *testing.T) {
Annotations: map[string]string{"key": "value"},
Labels: map[string]string{"label": "value2"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
-
- ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
PodMetadata: &vmv1beta1.EmbeddedObjectMetadata{
Annotations: map[string]string{"key": "value"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
-
- ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
},
},
},
@@ -122,8 +128,11 @@ func TestCreateOrUpdate(t *testing.T) {
RetentionPeriod: "2",
ReplicationFactor: ptr.To(int32(2)),
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
InsertPorts: &vmv1beta1.InsertPorts{
GraphitePort: "8025",
OpenTSDBHTTPPort: "3311",
@@ -148,8 +157,11 @@ func TestCreateOrUpdate(t *testing.T) {
RetentionPeriod: "2",
ReplicationFactor: ptr.To(int32(2)),
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
InsertPorts: &vmv1beta1.InsertPorts{
GraphitePort: "8025",
OpenTSDBHTTPPort: "3311",
@@ -185,8 +197,11 @@ func TestCreateOrUpdate(t *testing.T) {
RetentionPeriod: "2",
ReplicationFactor: ptr.To(int32(2)),
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
HPA: &vmv1beta1.EmbeddedHPA{
MinReplicas: ptr.To(int32(1)),
MaxReplicas: 3,
@@ -217,18 +232,27 @@ func TestCreateOrUpdate(t *testing.T) {
RetentionPeriod: "2",
ReplicationFactor: ptr.To(int32(2)),
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VMStorage: &vmv1beta1.VMStorage{
MaintenanceSelectNodeIDs: []int32{1, 3},
MaintenanceInsertNodeIDs: []int32{0, 1, 2},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(10))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(10)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
},
},
},
@@ -287,18 +311,27 @@ func TestCreateOrUpdate(t *testing.T) {
RetentionPeriod: "2",
ReplicationFactor: ptr.To(int32(2)),
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VMStorage: &vmv1beta1.VMStorage{
MaintenanceSelectNodeIDs: []int32{1, 3},
MaintenanceInsertNodeIDs: []int32{0, 1, 2},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(10))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(10)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
},
},
},
@@ -360,20 +393,30 @@ func TestCreateOrUpdate(t *testing.T) {
Enabled: true,
Spec: vmv1beta1.VMAuthLoadBalancerSpec{
CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0))},
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
InsertPorts: &vmv1beta1.InsertPorts{
GraphitePort: "8025",
OpenTSDBHTTPPort: "3311",
@@ -407,13 +450,19 @@ func TestCreateOrUpdate(t *testing.T) {
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ },
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ },
},
},
},
@@ -434,16 +483,18 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1beta1.VMClusterSpec{
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
- Volumes: []corev1.Volume{{
- Name: "vmselect-cachedir",
- VolumeSource: corev1.VolumeSource{
- HostPath: &corev1.HostPathVolumeSource{
- Path: "/host/path/cache",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ Volumes: []corev1.Volume{{
+ Name: "vmselect-cachedir",
+ VolumeSource: corev1.VolumeSource{
+ HostPath: &corev1.HostPathVolumeSource{
+ Path: "/host/path/cache",
+ },
},
- },
- }},
+ }},
+ },
},
CacheMountPath: "/cache",
VPA: &vmv1beta1.EmbeddedVPA{
@@ -532,16 +583,18 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1beta1.VMClusterSpec{
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
- Volumes: []corev1.Volume{{
- Name: "vmstorage-db",
- VolumeSource: corev1.VolumeSource{
- HostPath: &corev1.HostPathVolumeSource{
- Path: "/host/path/storage",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ Volumes: []corev1.Volume{{
+ Name: "vmstorage-db",
+ VolumeSource: corev1.VolumeSource{
+ HostPath: &corev1.HostPathVolumeSource{
+ Path: "/host/path/storage",
+ },
},
- },
- }},
+ }},
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -637,8 +690,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1beta1.VMClusterSpec{
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -730,8 +785,10 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1beta1.VMClusterSpec{
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
},
},
@@ -761,18 +818,24 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1beta1.VMClusterSpec{
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
ManagedMetadata: &vmv1beta1.ManagedObjectsMetadata{
@@ -819,18 +882,24 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1beta1.VMClusterSpec{
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -955,6 +1024,11 @@ spec:
Port: 8011,
TargetPort: intstr.FromInt(8011),
},
+ {
+ Name: "http",
+ Port: 8482,
+ TargetPort: intstr.FromInt(8482),
+ },
},
},
},
@@ -1020,8 +1094,10 @@ spec:
Spec: vmv1beta1.VMClusterSpec{
VMStorage: &vmv1beta1.VMStorage{},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Port: "8352",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: "8352",
+ },
},
},
},
@@ -1105,8 +1181,19 @@ spec:
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default-1"},
Spec: vmv1beta1.VMClusterSpec{
VMStorage: &vmv1beta1.VMStorage{},
- VMSelect: &vmv1beta1.VMSelect{CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "8352"},
- ClusterNativePort: "8477", ServiceSpec: &vmv1beta1.AdditionalServiceSpec{Spec: corev1.ServiceSpec{Type: "LoadBalancer"}}},
+ VMSelect: &vmv1beta1.VMSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: "8352",
+ },
+ },
+ ClusterNativePort: "8477",
+ ServiceSpec: &vmv1beta1.AdditionalServiceSpec{
+ Spec: corev1.ServiceSpec{
+ Type: "LoadBalancer",
+ },
+ },
+ },
},
}, `
objectmeta:
@@ -1858,13 +1945,25 @@ func TestVMClusterDiscoveryArgs(t *testing.T) {
License: &vmv1beta1.License{Key: licenseKey},
Discovery: &vmv1beta1.VMClusterDiscovery{Enabled: true},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
},
@@ -1881,13 +1980,25 @@ func TestVMClusterDiscoveryArgs(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1beta1.VMClusterSpec{
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
},
@@ -1908,14 +2019,26 @@ func TestVMClusterDiscoveryArgs(t *testing.T) {
License: &vmv1beta1.License{Key: licenseKey},
Discovery: &vmv1beta1.VMClusterDiscovery{Enabled: true},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
- Discovery: &vmv1beta1.VMClusterDiscovery{Enabled: false},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
+ Discovery: &vmv1beta1.VMClusterDiscovery{Enabled: false},
},
},
},
@@ -1939,13 +2062,25 @@ func TestVMClusterDiscoveryArgs(t *testing.T) {
Filter: `vmstorage-test-[0-1]\.`,
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(2))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
},
@@ -1972,10 +2107,18 @@ func TestVMClusterDiscoveryArgs(t *testing.T) {
Filter: `vmstorage-test-[0-1]\.`,
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(4))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(4)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
Discovery: &vmv1beta1.VMClusterDiscovery{
Enabled: true,
Interval: "10s",
@@ -1983,7 +2126,11 @@ func TestVMClusterDiscoveryArgs(t *testing.T) {
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
},
@@ -2002,16 +2149,28 @@ func TestVMClusterDiscoveryArgs(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1beta1.VMClusterSpec{
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
ExtraStorageNodes: []vmv1beta1.VMStorageNode{
{Addr: "localhost:10101"},
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
},
@@ -2040,16 +2199,28 @@ func TestVMClusterDiscoveryArgs(t *testing.T) {
License: &vmv1beta1.License{Key: licenseKey},
Discovery: &vmv1beta1.VMClusterDiscovery{Enabled: true},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
ExtraStorageNodes: []vmv1beta1.VMStorageNode{
{Addr: "localhost:10101"},
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
},
diff --git a/internal/controller/operator/factory/vmdistributed/util_test.go b/internal/controller/operator/factory/vmdistributed/util_test.go
index 0bd348728e..cdbacc9290 100644
--- a/internal/controller/operator/factory/vmdistributed/util_test.go
+++ b/internal/controller/operator/factory/vmdistributed/util_test.go
@@ -24,8 +24,10 @@ func TestMergeSpecs(t *testing.T) {
f(&vmv1beta1.VMClusterSpec{
RetentionPeriod: "1d",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
}, &vmv1beta1.VMClusterSpec{
@@ -33,8 +35,10 @@ func TestMergeSpecs(t *testing.T) {
}, "zone-a", &vmv1beta1.VMClusterSpec{
RetentionPeriod: "30d",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
})
@@ -43,10 +47,12 @@ func TestMergeSpecs(t *testing.T) {
f(&vmv1beta1.VMClusterSpec{
RetentionPeriod: "1d",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- NodeSelector: map[string]string{
- "topology.kubernetes.io/zone": "%ZONE%",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ NodeSelector: map[string]string{
+ "topology.kubernetes.io/zone": "%ZONE%",
+ },
},
},
},
@@ -55,10 +61,12 @@ func TestMergeSpecs(t *testing.T) {
}, "zone-a", &vmv1beta1.VMClusterSpec{
RetentionPeriod: "30d",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- NodeSelector: map[string]string{
- "topology.kubernetes.io/zone": "zone-a",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ NodeSelector: map[string]string{
+ "topology.kubernetes.io/zone": "zone-a",
+ },
},
},
},
@@ -74,15 +82,19 @@ func TestMergeSpecs(t *testing.T) {
}
f(&vmv1alpha1.VMDistributedZoneAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- NodeSelector: map[string]string{
- "topology.kubernetes.io/zone": "%ZONE%",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ NodeSelector: map[string]string{
+ "topology.kubernetes.io/zone": "%ZONE%",
+ },
},
},
}, &vmv1alpha1.VMDistributedZoneAgentSpec{}, "zone-b", &vmv1alpha1.VMDistributedZoneAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- NodeSelector: map[string]string{
- "topology.kubernetes.io/zone": "zone-b",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ NodeSelector: map[string]string{
+ "topology.kubernetes.io/zone": "zone-b",
+ },
},
},
})
diff --git a/internal/controller/operator/factory/vmdistributed/vmdistributed_reconcile_test.go b/internal/controller/operator/factory/vmdistributed/vmdistributed_reconcile_test.go
index b3860e790b..b1cbf8d570 100644
--- a/internal/controller/operator/factory/vmdistributed/vmdistributed_reconcile_test.go
+++ b/internal/controller/operator/factory/vmdistributed/vmdistributed_reconcile_test.go
@@ -130,18 +130,24 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -155,8 +161,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
},
VMAuth: vmv1alpha1.VMDistributedAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -197,18 +205,24 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -255,18 +269,24 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -280,8 +300,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
},
VMAuth: vmv1alpha1.VMDistributedAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -329,18 +351,24 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -354,8 +382,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
},
VMAuth: vmv1alpha1.VMDistributedAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -404,19 +434,35 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
}
vmAuthSpec := vmv1alpha1.VMDistributedAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
}
@@ -587,18 +633,24 @@ func Test_CreateOrUpdate_Paused(t *testing.T) {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
diff --git a/internal/controller/operator/factory/vmdistributed/vmdistributed_test.go b/internal/controller/operator/factory/vmdistributed/vmdistributed_test.go
index ecda127bab..bd87291806 100644
--- a/internal/controller/operator/factory/vmdistributed/vmdistributed_test.go
+++ b/internal/controller/operator/factory/vmdistributed/vmdistributed_test.go
@@ -17,10 +17,15 @@ import (
vmv1alpha1 "github.com/VictoriaMetrics/operator/api/operator/v1alpha1"
vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
+ "github.com/VictoriaMetrics/operator/internal/controller/operator/factory/build"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/k8stools"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/reconcile"
)
+func init() {
+ build.AddDefaults(k8stools.GetTestClientWithObjectsAndInterceptors(nil, interceptor.Funcs{}).Scheme())
+}
+
func newVMAgent(name, namespace string, owner metav1.OwnerReference) *vmv1beta1.VMAgent {
return &vmv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
@@ -30,8 +35,10 @@ func newVMAgent(name, namespace string, owner metav1.OwnerReference) *vmv1beta1.
OwnerReferences: []metav1.OwnerReference{owner},
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
}
@@ -49,18 +56,24 @@ func newVMCluster(name, namespace, version string, owner metav1.OwnerReference)
Spec: vmv1beta1.VMClusterSpec{
ClusterVersion: version,
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -116,13 +129,17 @@ func beforeEach(o opts) *testData {
},
},
}
+ scheme := k8stools.GetTestClientWithObjectsAndInterceptors(nil, interceptor.Funcs{}).Scheme()
+
var predefinedObjects []runtime.Object
var vmclusters []*vmv1beta1.VMCluster
owner := cr.AsOwner()
for i := range cr.Spec.Zones {
name := fmt.Sprintf("vmcluster-%d", i+1)
vmCluster := newVMCluster(name, namespace, "v1.0.0", owner)
+ scheme.Default(vmCluster)
vmAgent := newVMAgent(name, namespace, owner)
+ scheme.Default(vmAgent)
zs.backends = append(zs.backends, vmBackend{obj: vmCluster})
zs.vmagents = append(zs.vmagents, vmAgent)
vmclusters = append(vmclusters, vmCluster)
diff --git a/internal/controller/operator/factory/vmdistributed/zone.go b/internal/controller/operator/factory/vmdistributed/zone.go
index efbe6a9f1a..0c8b2ce515 100644
--- a/internal/controller/operator/factory/vmdistributed/zone.go
+++ b/internal/controller/operator/factory/vmdistributed/zone.go
@@ -148,6 +148,7 @@ func getZones(ctx context.Context, rclient client.Client, cr *vmv1alpha1.VMDistr
OwnerReferences: []metav1.OwnerReference{cr.AsOwner()},
}
}
+ rclient.Scheme().Default(&vmAgent)
vmAgentCustomSpec, err := podutil.MergeSpecs(&cr.Spec.ZoneCommon.VMAgent.Spec, &z.VMAgent.Spec, z.Name)
if err != nil {
return nil, fmt.Errorf("spec.zones[%d].vmagent.spec: %w", i, err)
@@ -219,6 +220,7 @@ func buildVMClusterBackend(ctx context.Context, rclient client.Client, cr *vmv1a
OwnerReferences: []metav1.OwnerReference{cr.AsOwner()},
}
}
+ rclient.Scheme().Default(&vmCluster)
vmClusterSpec, err := podutil.MergeSpecs(&cr.Spec.ZoneCommon.VMCluster.Spec, &z.VMCluster.Spec, z.Name)
if err != nil {
return vmBackend{}, false, fmt.Errorf("vmcluster.spec: %w", err)
@@ -253,6 +255,7 @@ func buildVMSingleBackend(ctx context.Context, rclient client.Client, cr *vmv1al
OwnerReferences: []metav1.OwnerReference{cr.AsOwner()},
}
}
+ rclient.Scheme().Default(&vmSingle)
var commonSpec *vmv1beta1.VMSingleSpec
if cr.Spec.ZoneCommon.VMSingle != nil {
commonSpec = cr.Spec.ZoneCommon.VMSingle.Spec
diff --git a/internal/controller/operator/factory/vmsingle/vmsingle.go b/internal/controller/operator/factory/vmsingle/vmsingle.go
index 3c196c5c61..2ebc7b8a2a 100644
--- a/internal/controller/operator/factory/vmsingle/vmsingle.go
+++ b/internal/controller/operator/factory/vmsingle/vmsingle.go
@@ -31,15 +31,16 @@ import (
)
const (
- confDir = "/etc/vm/config"
- confOutDir = "/etc/vm/config_out"
- tlsAssetsDir = "/etc/vm-tls/certs"
- dataDir = "/victoria-metrics-data"
- dataVolumeName = "data"
- streamAggrSecretKey = "config.yaml"
- relabelingName = "relabeling.yaml"
- scrapeGzippedFilename = "scrape.yaml.gz"
- configFilename = "scrape.yaml"
+ confDir = "/etc/vm/config"
+ confOutDir = "/etc/vm/config_out"
+ tlsAssetsDir = "/etc/vm-tls/certs"
+ tlsServerConfigMountPath = "/etc/vm/tls-server-secrets"
+ dataDir = "/victoria-metrics-data"
+ dataVolumeName = "data"
+ streamAggrSecretKey = "config.yaml"
+ relabelingName = "relabeling.yaml"
+ scrapeGzippedFilename = "scrape.yaml.gz"
+ configFilename = "scrape.yaml"
)
func isStorageEmpty(pvc *corev1.PersistentVolumeClaimSpec) bool {
@@ -233,7 +234,6 @@ func newPodSpec(ctx context.Context, cr *vmv1beta1.VMSingle, extraConfigSecretCo
}
cfg := config.MustGetBaseConfig()
- args = append(args, fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Port))
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -245,8 +245,7 @@ func newPodSpec(ctx context.Context, cr *vmv1beta1.VMSingle, extraConfigSecretCo
var envs []corev1.EnvVar
envs = append(envs, cr.Spec.ExtraEnvs...)
- var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(cr.Spec.Port).IntVal})
+ ports := build.AddHTTPListenerPortsTo(nil, cr.Spec.HTTPListeners)
ports = build.AppendInsertPorts(ports, cr.Spec.InsertPorts)
var crMounts []corev1.VolumeMount
@@ -398,6 +397,8 @@ func newPodSpec(ctx context.Context, cr *vmv1beta1.VMSingle, extraConfigSecretCo
volumes, vmMounts = build.LicenseVolumeTo(volumes, vmMounts, cr.Spec.License, vmv1beta1.SecretsDir)
args = build.LicenseArgsTo(args, cr.Spec.License, vmv1beta1.SecretsDir)
volumes, vmMounts = build.OpenShiftServiceCAVolumeTo(volumes, vmMounts)
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
args = build.AddExtraArgsOverrideDefaults(args, cr.Spec.ExtraArgs, "-")
sort.Strings(args)
vmsingleContainer := corev1.Container{
@@ -464,7 +465,7 @@ func newPodSpec(ctx context.Context, cr *vmv1beta1.VMSingle, extraConfigSecretCo
}
if cr.Spec.VMBackup != nil {
- vmBackupManagerContainer, err := build.VMBackupManager(ctx, cr.Spec.VMBackup, cr.Spec.Port, storagePath, commonMounts, cr.Spec.ExtraArgs, false, cr.Spec.License)
+ vmBackupManagerContainer, err := build.VMBackupManager(ctx, cr, storagePath, commonMounts, false, cr.Spec.License)
if err != nil {
return nil, err
}
@@ -516,25 +517,30 @@ func buildScrape(cr *vmv1beta1.VMSingle, svc *corev1.Service) *vmv1beta1.VMServi
if cr == nil || svc == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- scrape := build.VMServiceScrape(svc, cr, "vmbackupmanager")
+ var sidecars []build.ScrapeBuilder
+ if cr.Spec.VMBackup != nil {
+ sidecars = append(sidecars, cr.Spec.VMBackup)
+ }
if cr.HasConfigReloader() {
- scrape.Spec.Endpoints = append(scrape.Spec.Endpoints, build.ConfigReloaderVMServiceScrapeEndpoint())
+ sidecars = append(sidecars, build.ConfigReloaderScrapeBuilder)
}
- return scrape
+ return build.VMServiceScrape(svc, cr, sidecars...)
}
func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1beta1.VMSingle) error {
- addExtraPorts := func(svc *corev1.Service, vmb *vmv1beta1.VMBackup) {
- if cr.Spec.Port != "8428" {
+ addExtraPorts := func(svc *corev1.Service, r *vmv1beta1.VMSingle) {
+ primaryPort := r.Spec.PrimaryPort(r.Spec.Port)
+ if primaryPort != "8428" {
// conditionally add 8428 port to be compatible with binary port
svc.Spec.Ports = append(svc.Spec.Ports, corev1.ServicePort{
Name: "http-alias",
Protocol: "TCP",
Port: 8428,
- TargetPort: intstr.Parse(cr.Spec.Port),
+ TargetPort: intstr.Parse(primaryPort),
})
}
+ vmb := r.Spec.VMBackup
if vmb != nil {
parsedPort := intstr.Parse(vmb.Port)
svc.Spec.Ports = append(svc.Spec.Ports, corev1.ServicePort{
@@ -546,14 +552,16 @@ func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevC
}
}
svc := build.Service(cr, cr.Spec.Port, func(svc *corev1.Service) {
- addExtraPorts(svc, cr.Spec.VMBackup)
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.HTTPListeners)
+ addExtraPorts(svc, cr)
build.AppendInsertPortsToService(cr.Spec.InsertPorts, svc)
})
var prevSvc, prevAdditionalSvc *corev1.Service
if prevCR != nil {
prevSvc = build.Service(prevCR, prevCR.Spec.Port, func(svc *corev1.Service) {
- addExtraPorts(svc, prevCR.Spec.VMBackup)
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.HTTPListeners)
+ addExtraPorts(svc, prevCR)
build.AppendInsertPortsToService(prevCR.Spec.InsertPorts, svc)
})
prevAdditionalSvc = build.AdditionalServiceFromDefault(prevSvc, prevCR.Spec.ServiceSpec)
diff --git a/internal/controller/operator/factory/vmsingle/vmsingle_reconcile_test.go b/internal/controller/operator/factory/vmsingle/vmsingle_reconcile_test.go
index c876b87dd2..508cb6efd0 100644
--- a/internal/controller/operator/factory/vmsingle/vmsingle_reconcile_test.go
+++ b/internal/controller/operator/factory/vmsingle/vmsingle_reconcile_test.go
@@ -138,8 +138,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
cr: &vmv1beta1.VMSingle{
ObjectMeta: objectMeta,
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -161,8 +163,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
cr: &vmv1beta1.VMSingle{
ObjectMeta: objectMeta,
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -193,9 +197,11 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Paused: true,
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vmsingle/vmsingle_test.go b/internal/controller/operator/factory/vmsingle/vmsingle_test.go
index e27767a2b9..4ef1ea640c 100644
--- a/internal/controller/operator/factory/vmsingle/vmsingle_test.go
+++ b/internal/controller/operator/factory/vmsingle/vmsingle_test.go
@@ -61,8 +61,11 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
predefinedObjects: []runtime.Object{
@@ -93,8 +96,11 @@ func TestCreateOrUpdate(t *testing.T) {
GraphitePort: "8053",
OpenTSDBPort: "8054",
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
+ },
},
},
predefinedObjects: []runtime.Object{
@@ -321,12 +327,14 @@ func TestMakeSpecForVMSingleOk(t *testing.T) {
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
IngestOnlyMode: ptr.To(false),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.97.1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.97.1",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "8428",
},
- UseDefaultResources: ptr.To(false),
- Port: "8428",
},
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: "vmcustomer:v1",
diff --git a/internal/controller/operator/factory/vtagent/vtagent.go b/internal/controller/operator/factory/vtagent/vtagent.go
index 767f95bbb5..f73873c23d 100644
--- a/internal/controller/operator/factory/vtagent/vtagent.go
+++ b/internal/controller/operator/factory/vtagent/vtagent.go
@@ -16,7 +16,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
@@ -46,12 +45,14 @@ func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevC
prevService = build.Service(prevCR, prevCR.Spec.Port, func(svc *corev1.Service) {
svc.Spec.ClusterIP = "None"
build.AddOTLPGRPCPortToService(svc, prevCR.Spec.GRPCSpec)
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.HTTPListeners)
})
prevAdditionalService = build.AdditionalServiceFromDefault(prevService, prevCR.Spec.ServiceSpec)
}
newService := build.Service(cr, cr.Spec.Port, func(svc *corev1.Service) {
svc.Spec.ClusterIP = "None"
build.AddOTLPGRPCPortToService(svc, cr.Spec.GRPCSpec)
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.HTTPListeners)
})
owner := cr.AsOwner()
@@ -78,7 +79,7 @@ func buildScrape(cr *vmv1.VTAgent) *vmv1beta1.VMPodScrape {
if cr == nil || ptr.Deref(cr.Spec.DisableSelfServiceScrape, false) {
return nil
}
- return build.VMPodScrape(cr, "http")
+ return build.VMPodScrape(cr)
}
// CreateOrUpdate creates statefulset for vtagent and configures it
@@ -225,7 +226,6 @@ func newPodSpec(cr *vmv1.VTAgent) (*corev1.PodSpec, error) {
}
cfg := config.MustGetBaseConfig()
- args = append(args, fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Port))
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -239,6 +239,7 @@ func newPodSpec(cr *vmv1.VTAgent) (*corev1.PodSpec, error) {
args = append(args, "-envflag.enable=true")
}
args = build.AddOTLPGRPCArgsTo(args, cr.Spec.GRPCSpec, tlsServerConfigMountPath)
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
var vtMounts []corev1.VolumeMount
var volumes []corev1.Volume
@@ -259,12 +260,13 @@ func newPodSpec(cr *vmv1.VTAgent) (*corev1.PodSpec, error) {
var envs []corev1.EnvVar
envs = append(envs, cr.Spec.ExtraEnvs...)
var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(cr.Spec.Port).IntVal})
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.HTTPListeners)
ports = build.AddOTLPGRPCPortTo(ports, cr.Spec.GRPCSpec)
vtMounts = append(vtMounts, cr.Spec.VolumeMounts...)
volumes = append(volumes, cr.Spec.Volumes...)
volumes, vtMounts = build.AddOTLPGRPCTLSConfigToVolumes(volumes, vtMounts, cr.Spec.GRPCSpec, tlsServerConfigMountPath)
+ volumes, vtMounts = build.AddHTTPListenerTLSToVolumes(volumes, vtMounts, cr.Spec.HTTPListeners, tlsServerConfigMountPath)
for _, s := range cr.Spec.Secrets {
volumes = append(volumes, corev1.Volume{
diff --git a/internal/controller/operator/factory/vtagent/vtagent_test.go b/internal/controller/operator/factory/vtagent/vtagent_test.go
index e5721da340..eb8314eb9b 100644
--- a/internal/controller/operator/factory/vtagent/vtagent_test.go
+++ b/internal/controller/operator/factory/vtagent/vtagent_test.go
@@ -70,8 +70,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
Storage: &vmv1beta1.StorageSpec{
VolumeClaimTemplate: vmv1beta1.EmbeddedPersistentVolumeClaim{
@@ -128,8 +130,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{URL: "http://remote-write"},
@@ -220,8 +224,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
PodDisruptionBudget: &vmv1beta1.EmbeddedPodDisruptionBudgetSpec{
MinAvailable: ptr.To(intstr.FromInt32(1)),
@@ -265,8 +271,10 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
Storage: &vmv1beta1.StorageSpec{
VolumeClaimTemplate: vmv1beta1.EmbeddedPersistentVolumeClaim{
@@ -323,8 +331,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{
@@ -377,8 +387,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{
@@ -436,9 +448,11 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
- Secrets: []string{"shared-secret"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ Secrets: []string{"shared-secret"},
+ },
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{
@@ -501,8 +515,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{
@@ -565,8 +581,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{
@@ -659,9 +677,11 @@ func TestCreateOrUpdate(t *testing.T) {
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- TerminationGracePeriodSeconds: ptr.To[int64](60),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ TerminationGracePeriodSeconds: ptr.To[int64](60),
+ },
},
},
},
@@ -1272,22 +1292,24 @@ func TestMakeSpecForAgentOk(t *testing.T) {
f(&vmv1.VTAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "vt-repo",
- Tag: "v0.11.0",
- },
- Resources: corev1.ResourceRequirements{
- Limits: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("10m"),
- corev1.ResourceMemory: resource.MustParse("10Mi"),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "vt-repo",
+ Tag: "v0.11.0",
},
- Requests: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("10m"),
- corev1.ResourceMemory: resource.MustParse("10Mi"),
+ Resources: corev1.ResourceRequirements{
+ Limits: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("10m"),
+ corev1.ResourceMemory: resource.MustParse("10Mi"),
+ },
+ Requests: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("10m"),
+ corev1.ResourceMemory: resource.MustParse("10Mi"),
+ },
},
+ Port: "10429",
},
- Port: "10429",
},
},
}, []runtime.Object{}, `
@@ -1350,12 +1372,14 @@ serviceaccountname: vtagent-agent
f(&vmv1.VTAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v0.11.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v0.11.0",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "10429",
},
- UseDefaultResources: ptr.To(false),
- Port: "10429",
},
},
}, []runtime.Object{}, `
@@ -1407,12 +1431,14 @@ serviceaccountname: vtagent-agent
f(&vmv1.VTAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v0.11.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v0.11.0",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "10429",
},
- UseDefaultResources: ptr.To(false),
- Port: "10429",
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{
@@ -1480,12 +1506,14 @@ serviceaccountname: vtagent-agent
f(&vmv1.VTAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v0.11.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v0.11.0",
+ },
+ UseDefaultResources: ptr.To(false),
+ Port: "10429",
},
- UseDefaultResources: ptr.To(false),
- Port: "10429",
},
GRPCSpec: &vmv1.OTLPGRPCSpec{
ListenPort: 4317,
@@ -1572,9 +1600,11 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{URL: "http://remote-write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Paused: true,
+ },
},
},
}
@@ -1632,7 +1662,9 @@ func TestCreateOrUpdateService(t *testing.T) {
cr: &vmv1.VTAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10429"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10429"},
+ },
ServiceSpec: &vmv1beta1.AdditionalServiceSpec{
UseAsDefault: true,
Spec: corev1.ServiceSpec{
@@ -1663,7 +1695,9 @@ func TestCreateOrUpdateService(t *testing.T) {
cr: &vmv1.VTAgent{
ObjectMeta: metav1.ObjectMeta{Name: "agent", Namespace: "default"},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10429"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10429"},
+ },
ServiceSpec: &vmv1beta1.AdditionalServiceSpec{
EmbeddedObjectMetadata: vmv1beta1.EmbeddedObjectMetadata{Name: "vtagent-extra"},
Spec: corev1.ServiceSpec{
diff --git a/internal/controller/operator/factory/vtcluster/cluster.go b/internal/controller/operator/factory/vtcluster/cluster.go
index 47645dc42a..54707fc764 100644
--- a/internal/controller/operator/factory/vtcluster/cluster.go
+++ b/internal/controller/operator/factory/vtcluster/cluster.go
@@ -46,11 +46,11 @@ func CreateOrUpdate(ctx context.Context, rclient client.Client, cr *vmv1.VTClust
}
}
if cr.IsOwnsServiceAccount() {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
sa := build.ServiceAccount(b)
var prevSA *corev1.ServiceAccount
if prevCR != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentRoot)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentRoot)
prevSA = build.ServiceAccount(b)
}
if err := reconcile.ServiceAccount(ctx, rclient, sa, prevSA, &owner); err != nil {
@@ -206,7 +206,7 @@ func deleteOrphaned(ctx context.Context, rclient client.Client, cr *vmv1.VTClust
}
}
if !cr.IsOwnsServiceAccount() {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentRoot)
objMeta := metav1.ObjectMeta{Name: b.PrefixedName(), Namespace: b.GetNamespace()}
objsToRemove := []client.Object{&corev1.ServiceAccount{ObjectMeta: objMeta}}
if err := finalize.SafeDeleteWithFinalizer(ctx, rclient, objsToRemove, b); err != nil {
diff --git a/internal/controller/operator/factory/vtcluster/cluster_test.go b/internal/controller/operator/factory/vtcluster/cluster_test.go
index 9c3d6a3091..2e0bdf5292 100644
--- a/internal/controller/operator/factory/vtcluster/cluster_test.go
+++ b/internal/controller/operator/factory/vtcluster/cluster_test.go
@@ -75,18 +75,24 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VTClusterSpec{
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
},
},
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
},
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
},
},
},
@@ -189,8 +195,10 @@ func TestCreateOrUpdate(t *testing.T) {
RetentionPeriod: "1w",
RetentionMaxDiskSpaceUsageBytes: "5GB",
FutureRetention: "2d",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -214,14 +222,18 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VTClusterSpec{
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Storage: &vmv1.VTStorage{
RetentionPeriod: "1w",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
HPA: &vmv1beta1.EmbeddedHPA{
MinReplicas: ptr.To(int32(0)),
@@ -242,8 +254,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1.VTClusterSpec{
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -305,8 +319,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1.VTClusterSpec{
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -379,8 +395,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1.VTClusterSpec{
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -466,8 +484,10 @@ func TestCreateOrUpdate(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: "default"},
Spec: vmv1.VTClusterSpec{
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
VPA: &vmv1beta1.EmbeddedVPA{
UpdatePolicy: &vpav1.PodUpdatePolicy{
@@ -565,8 +585,10 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VTClusterSpec{
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
},
},
@@ -604,13 +626,25 @@ func TestCreateOrUpdate(t *testing.T) {
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
},
},
@@ -644,13 +678,25 @@ func TestCreateOrUpdate(t *testing.T) {
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
},
},
@@ -673,18 +719,24 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VTClusterSpec{
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
ManagedMetadata: &vmv1beta1.ManagedObjectsMetadata{
@@ -731,18 +783,24 @@ func TestCreateOrUpdate(t *testing.T) {
},
Spec: vmv1.VTClusterSpec{
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
diff --git a/internal/controller/operator/factory/vtcluster/insert.go b/internal/controller/operator/factory/vtcluster/insert.go
index b8a2ede01e..f96e86198e 100644
--- a/internal/controller/operator/factory/vtcluster/insert.go
+++ b/internal/controller/operator/factory/vtcluster/insert.go
@@ -13,7 +13,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -26,7 +25,7 @@ import (
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/reconcile"
)
-const insertTLSServerConfigMountPath = "/etc/vt/tls-server-secrets"
+const tlsServerConfigMountPath = "/etc/vt/tls-server-secrets"
func createOrUpdateVTInsert(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VTCluster) error {
if cr.Spec.Insert == nil {
@@ -37,11 +36,11 @@ func createOrUpdateVTInsert(ctx context.Context, rclient client.Client, cr, prev
return err
}
if cr.Spec.Insert.NetworkPolicy != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
np := build.NetworkPolicy(b, cr.Spec.Insert.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.Insert != nil && prevCR.Spec.Insert.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevNP = build.NetworkPolicy(b, prevCR.Spec.Insert.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -65,11 +64,11 @@ func createOrUpdatePodDisruptionBudgetForVTInsert(ctx context.Context, rclient c
if cr.Spec.Insert.PodDisruptionBudget == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
pdb := build.PodDisruptionBudget(b, cr.Spec.Insert.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.Insert.PodDisruptionBudget != nil {
- b := build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.Insert.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -140,7 +139,6 @@ func buildVTInsertDeployment(cr *vmv1.VTCluster) (*appsv1.Deployment, error) {
func buildVTInsertPodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error) {
cfg := config.MustGetBaseConfig()
args := []string{
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Insert.Port),
"-internalselect.disable=true",
}
if cfg.EnableTCP6 {
@@ -156,7 +154,7 @@ func buildVTInsertPodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error) {
storageNodeFlag := build.NewFlag("-storageNode", "")
storageNodeIds := cr.AvailableStorageNodeIDs(vmv1beta1.ClusterComponentInsert)
for idx, i := range storageNodeIds {
- storageNodeFlag.Add(vmv1beta1.PodDNSAddress(cr.PrefixedName(vmv1beta1.ClusterComponentStorage), i, cr.Namespace, cr.Spec.Storage.Port, cr.Spec.ClusterDomainName), idx)
+ storageNodeFlag.Add(vmv1beta1.PodDNSAddress(cr.PrefixedName(vmv1beta1.ClusterComponentStorage), i, cr.Namespace, cr.Spec.Storage.PrimaryPort(cr.Spec.Storage.Port), cr.Spec.ClusterDomainName), idx)
}
totalNodes := len(storageNodeIds)
args = build.AppendFlagsToArgs(args, totalNodes, storageNodeFlag)
@@ -164,19 +162,13 @@ func buildVTInsertPodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error) {
if len(cr.Spec.Insert.ExtraEnvs) > 0 || len(cr.Spec.Insert.ExtraEnvsFrom) > 0 {
args = append(args, "-envflag.enable=true")
}
- args = build.AddOTLPGRPCArgsTo(args, cr.Spec.Insert.GRPCSpec, insertTLSServerConfigMountPath)
+ args = build.AddOTLPGRPCArgsTo(args, cr.Spec.Insert.GRPCSpec, tlsServerConfigMountPath)
var envs []corev1.EnvVar
envs = append(envs, cr.Spec.Insert.ExtraEnvs...)
- ports := []corev1.ContainerPort{
- {
- Name: "http",
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.Insert.Port).IntVal,
- },
- }
+ ports := build.AddHTTPListenerPortsTo(nil, cr.Spec.Insert.HTTPListeners)
ports = build.AddOTLPGRPCPortTo(ports, cr.Spec.Insert.GRPCSpec)
volumes := make([]corev1.Volume, 0)
@@ -184,7 +176,10 @@ func buildVTInsertPodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error) {
vmMounts := make([]corev1.VolumeMount, 0)
vmMounts = append(vmMounts, cr.Spec.Insert.VolumeMounts...)
- volumes, vmMounts = build.AddOTLPGRPCTLSConfigToVolumes(volumes, vmMounts, cr.Spec.Insert.GRPCSpec, insertTLSServerConfigMountPath)
+ volumes, vmMounts = build.AddOTLPGRPCTLSConfigToVolumes(volumes, vmMounts, cr.Spec.Insert.GRPCSpec, tlsServerConfigMountPath)
+
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.Insert.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.Insert.HTTPListeners, tlsServerConfigMountPath)
for _, s := range cr.Spec.Insert.Secrets {
volumes = append(volumes, corev1.Volume{
@@ -279,11 +274,11 @@ func createOrUpdateVTInsertHPA(ctx context.Context, rclient client.Client, cr, p
Kind: "Deployment",
APIVersion: "apps/v1",
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
newHPA := build.HPA(b, targetRef, cr.Spec.Insert.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.Insert.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.Insert.HPA)
}
owner := cr.AsOwner()
@@ -294,7 +289,7 @@ func createOrUpdateVTInsertVPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.Insert.VPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -303,7 +298,7 @@ func createOrUpdateVTInsertVPA(ctx context.Context, rclient client.Client, cr, p
newVPA := build.VPA(b, targetRef, cr.Spec.Insert.VPA)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.Insert != nil && prevCR.Spec.Insert.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentInsert)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.Insert.VPA)
}
owner := cr.AsOwner()
@@ -315,6 +310,9 @@ func buildVTInsertScrape(cr *vmv1.VTCluster, svc *corev1.Service) *vmv1beta1.VMS
return nil
}
svs := build.VMServiceScrape(svc, cr.Spec.Insert)
+ if svs == nil {
+ return nil
+ }
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableInsertBalancing {
svs.Spec.JobLabel = vmv1beta1.VMAuthLBServiceProxyJobNameLabel
}
@@ -353,10 +351,10 @@ func createOrUpdateVTInsertService(ctx context.Context, rclient client.Client, c
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableInsertBalancing {
var prevPort string
if prevCR != nil && prevCR.Spec.Insert != nil {
- prevPort = prevCR.Spec.Insert.Port
+ prevPort = prevCR.Spec.Insert.PrimaryPort(prevCR.Spec.Insert.Port)
}
kind := vmv1beta1.ClusterComponentInsert
- if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.Insert.Port, prevPort); err != nil {
+ if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.Insert.PrimaryPort(cr.Spec.Insert.Port), prevPort); err != nil {
return fmt.Errorf("cannot create lb svc for insert: %w", err)
}
}
@@ -371,9 +369,10 @@ func createOrUpdateVTInsertService(ctx context.Context, rclient client.Client, c
}
func buildVTInsertService(cr *vmv1.VTCluster) *corev1.Service {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentInsert)
svc := build.Service(b, cr.Spec.Insert.Port, func(svc *corev1.Service) {
build.AddOTLPGRPCPortToService(svc, cr.Spec.Insert.GRPCSpec)
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.Insert.HTTPListeners)
})
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableInsertBalancing {
svc.Name = cr.PrefixedInternalName(vmv1beta1.ClusterComponentInsert)
diff --git a/internal/controller/operator/factory/vtcluster/insert_test.go b/internal/controller/operator/factory/vtcluster/insert_test.go
index 93b58c44e6..e7f3577fc2 100644
--- a/internal/controller/operator/factory/vtcluster/insert_test.go
+++ b/internal/controller/operator/factory/vtcluster/insert_test.go
@@ -17,7 +17,9 @@ func TestBuildVTInsertPodSpec_GRPC(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "traces-1", Namespace: "default"},
Spec: vmv1.VTClusterSpec{
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10428"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10428"},
+ },
GRPCSpec: &vmv1.OTLPGRPCSpec{
ListenPort: 4317,
TLSConfig: &vmv1.TLSServerConfig{
@@ -51,7 +53,7 @@ func TestBuildVTInsertPodSpec_GRPC(t *testing.T) {
assert.Equal(t, "/etc/vt/tls-server-secrets/tls", m.MountPath)
}
}
- assert.True(t, found, "expected secret-tls-tls volume mount")
+ assert.True(t, found, "expected tls-tls volume mount")
}
func TestBuildVTInsertService_GRPC(t *testing.T) {
@@ -59,8 +61,10 @@ func TestBuildVTInsertService_GRPC(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "traces-1", Namespace: "default"},
Spec: vmv1.VTClusterSpec{
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10428"},
- GRPCSpec: &vmv1.OTLPGRPCSpec{ListenPort: 4317},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10428"},
+ },
+ GRPCSpec: &vmv1.OTLPGRPCSpec{ListenPort: 4317},
},
},
}
diff --git a/internal/controller/operator/factory/vtcluster/select.go b/internal/controller/operator/factory/vtcluster/select.go
index 194ddc457f..77a66692c9 100644
--- a/internal/controller/operator/factory/vtcluster/select.go
+++ b/internal/controller/operator/factory/vtcluster/select.go
@@ -13,7 +13,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -31,11 +30,11 @@ func createOrUpdateVTSelect(ctx context.Context, rclient client.Client, cr, prev
return nil
}
if cr.Spec.Select.PodDisruptionBudget != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
pdb := build.PodDisruptionBudget(b, cr.Spec.Select.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.Select.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.Select.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -45,11 +44,11 @@ func createOrUpdateVTSelect(ctx context.Context, rclient client.Client, cr, prev
}
}
if cr.Spec.Select.NetworkPolicy != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
np := build.NetworkPolicy(b, cr.Spec.Select.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.Select != nil && prevCR.Spec.Select.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevNP = build.NetworkPolicy(b, prevCR.Spec.Select.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -81,11 +80,11 @@ func createOrUpdateVTSelectHPA(ctx context.Context, rclient client.Client, cr, p
Kind: "Deployment",
APIVersion: "apps/v1",
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
defaultHPA := build.HPA(b, targetRef, cr.Spec.Select.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.Select.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.Select.HPA)
}
owner := cr.AsOwner()
@@ -96,7 +95,7 @@ func createOrUpdateVTSelectVPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.Select.VPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -105,7 +104,7 @@ func createOrUpdateVTSelectVPA(ctx context.Context, rclient client.Client, cr, p
newVPA := build.VPA(b, targetRef, cr.Spec.Select.VPA)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.Select != nil && prevCR.Spec.Select.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentSelect)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.Select.VPA)
}
owner := cr.AsOwner()
@@ -117,6 +116,9 @@ func buildVTSelectScrape(cr *vmv1.VTCluster, svc *corev1.Service) *vmv1beta1.VMS
return nil
}
svs := build.VMServiceScrape(svc, cr.Spec.Select)
+ if svs == nil {
+ return nil
+ }
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableSelectBalancing {
svs.Spec.JobLabel = vmv1beta1.VMAuthLBServiceProxyJobNameLabel
}
@@ -153,10 +155,10 @@ func createOrUpdateVTSelectService(ctx context.Context, rclient client.Client, c
if cr.Spec.RequestsLoadBalancer.Enabled && !cr.Spec.RequestsLoadBalancer.DisableSelectBalancing {
var prevPort string
if prevCR != nil && prevCR.Spec.Select != nil {
- prevPort = prevCR.Spec.Select.Port
+ prevPort = prevCR.Spec.Select.PrimaryPort(prevCR.Spec.Select.Port)
}
kind := vmv1beta1.ClusterComponentSelect
- if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.Select.Port, prevPort); err != nil {
+ if err := createOrUpdateLBProxyService(ctx, rclient, cr, prevCR, kind, cr.Spec.Select.PrimaryPort(cr.Spec.Select.Port), prevPort); err != nil {
return fmt.Errorf("cannot create lb svc for select: %w", err)
}
}
@@ -171,8 +173,9 @@ func createOrUpdateVTSelectService(ctx context.Context, rclient client.Client, c
}
func buildVTSelectService(cr *vmv1.VTCluster) *corev1.Service {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentSelect)
svc := build.Service(b, cr.Spec.Select.Port, func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.Select.HTTPListeners)
svc.Spec.ClusterIP = "None"
svc.Spec.PublishNotReadyAddresses = true
})
@@ -245,7 +248,6 @@ func buildVTSelectDeployment(cr *vmv1.VTCluster) (*appsv1.Deployment, error) {
func buildVTSelectPodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error) {
cfg := config.MustGetBaseConfig()
args := []string{
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Select.Port),
"-internalinsert.disable=true",
}
if cfg.EnableTCP6 {
@@ -261,7 +263,7 @@ func buildVTSelectPodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error) {
storageNodeFlag := build.NewFlag("-storageNode", "")
storageNodeIds := cr.AvailableStorageNodeIDs(vmv1beta1.ClusterComponentSelect)
for idx, i := range storageNodeIds {
- storageNodeFlag.Add(vmv1beta1.PodDNSAddress(cr.PrefixedName(vmv1beta1.ClusterComponentStorage), i, cr.Namespace, cr.Spec.Storage.Port, cr.Spec.ClusterDomainName), idx)
+ storageNodeFlag.Add(vmv1beta1.PodDNSAddress(cr.PrefixedName(vmv1beta1.ClusterComponentStorage), i, cr.Namespace, cr.Spec.Storage.PrimaryPort(cr.Spec.Storage.Port), cr.Spec.ClusterDomainName), idx)
}
if len(cr.Spec.Select.ExtraStorageNodes) > 0 {
for i, node := range cr.Spec.Select.ExtraStorageNodes {
@@ -281,19 +283,17 @@ func buildVTSelectPodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error) {
var envs []corev1.EnvVar
envs = append(envs, cr.Spec.Select.ExtraEnvs...)
- var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{
- Name: "http",
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.Select.Port).IntVal,
- })
-
volumes := make([]corev1.Volume, 0)
volumes = append(volumes, cr.Spec.Select.Volumes...)
vmMounts := make([]corev1.VolumeMount, 0)
vmMounts = append(vmMounts, cr.Spec.Select.VolumeMounts...)
+ var ports []corev1.ContainerPort
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.Select.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.Select.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.Select.HTTPListeners)
+
for _, s := range cr.Spec.Select.Secrets {
volumes = append(volumes, corev1.Volume{
Name: k8stools.SanitizeVolumeName("secret-" + s),
diff --git a/internal/controller/operator/factory/vtcluster/storage.go b/internal/controller/operator/factory/vtcluster/storage.go
index 91009e6d99..78c0711fe9 100644
--- a/internal/controller/operator/factory/vtcluster/storage.go
+++ b/internal/controller/operator/factory/vtcluster/storage.go
@@ -13,7 +13,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -32,11 +31,11 @@ func createOrUpdateVTStorage(ctx context.Context, rclient client.Client, cr, pre
}
if cr.Spec.Storage.PodDisruptionBudget != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
pdb := build.PodDisruptionBudget(b, cr.Spec.Storage.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.Storage.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.Storage.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -46,11 +45,11 @@ func createOrUpdateVTStorage(ctx context.Context, rclient client.Client, cr, pre
}
}
if cr.Spec.Storage.NetworkPolicy != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
np := build.NetworkPolicy(b, cr.Spec.Storage.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.Storage != nil && prevCR.Spec.Storage.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevNP = build.NetworkPolicy(b, prevCR.Spec.Storage.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -78,15 +77,17 @@ func buildVTStorageScrape(cr *vmv1.VTCluster, svc *corev1.Service) *vmv1beta1.VM
}
func createOrUpdateVTStorageService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VTCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
- svc := build.Service(b, cr.Spec.Storage.Port, func(svc *corev1.Service) {
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ svc := build.Service(b, cr.Spec.Storage.PrimaryPort(cr.Spec.Storage.Port), func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.Storage.HTTPListeners)
svc.Spec.ClusterIP = "None"
svc.Spec.PublishNotReadyAddresses = true
})
var prevSvc, prevAdditionalSvc *corev1.Service
if prevCR != nil && prevCR.Spec.Storage != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
- prevSvc = build.Service(b, prevCR.Spec.Storage.Port, func(svc *corev1.Service) {
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ prevSvc = build.Service(b, prevCR.Spec.Storage.PrimaryPort(prevCR.Spec.Storage.Port), func(svc *corev1.Service) {
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.Storage.HTTPListeners)
svc.Spec.ClusterIP = "None"
svc.Spec.PublishNotReadyAddresses = true
})
@@ -125,7 +126,7 @@ func createOrUpdateVTStorageHPA(ctx context.Context, rclient client.Client, cr,
if hpa == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
targetRef := autoscalingv2.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "StatefulSet",
@@ -134,7 +135,7 @@ func createOrUpdateVTStorageHPA(ctx context.Context, rclient client.Client, cr,
defaultHPA := build.HPA(b, targetRef, hpa)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.Storage.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.Storage.HPA)
}
owner := cr.AsOwner()
@@ -146,7 +147,7 @@ func createOrUpdateVTStorageVPA(ctx context.Context, rclient client.Client, cr,
if vpa == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentStorage)
targetRef := autoscalingv1.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "StatefulSet",
@@ -155,7 +156,7 @@ func createOrUpdateVTStorageVPA(ctx context.Context, rclient client.Client, cr,
newVPA := build.VPA(b, targetRef, vpa)
var prevVPA *vpav1.VerticalPodAutoscaler
if prevCR != nil && prevCR.Spec.Storage != nil && prevCR.Spec.Storage.VPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentStorage)
prevVPA = build.VPA(b, targetRef, prevCR.Spec.Storage.VPA)
}
owner := cr.AsOwner()
@@ -233,7 +234,6 @@ func buildVTStorageSTSSpec(cr *vmv1.VTCluster) (*appsv1.StatefulSet, error) {
func buildVTStoragePodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error) {
cfg := config.MustGetBaseConfig()
args := []string{
- fmt.Sprintf("-httpListenAddr=:%s", cr.Spec.Storage.Port),
fmt.Sprintf("-storageDataPath=%s", cr.Spec.Storage.StorageDataPath),
}
if cfg.EnableTCP6 {
@@ -270,13 +270,6 @@ func buildVTStoragePodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error)
envs = append(envs, cr.Spec.Storage.ExtraEnvs...)
- ports := []corev1.ContainerPort{
- {
- Name: "http",
- Protocol: "TCP",
- ContainerPort: intstr.Parse(cr.Spec.Storage.Port).IntVal,
- },
- }
volumes := make([]corev1.Volume, 0)
vmMounts := make([]corev1.VolumeMount, 0)
@@ -288,6 +281,11 @@ func buildVTStoragePodSpec(cr *vmv1.VTCluster) (*corev1.PodTemplateSpec, error)
vmMounts = append(vmMounts, cr.Spec.Storage.VolumeMounts...)
+ var ports []corev1.ContainerPort
+ args = build.AddHTTPListenerArgsTo(args, cr.Spec.Storage.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, cr.Spec.Storage.HTTPListeners, tlsServerConfigMountPath)
+ ports = build.AddHTTPListenerPortsTo(ports, cr.Spec.Storage.HTTPListeners)
+
for _, s := range cr.Spec.Storage.Secrets {
volumes = append(volumes, corev1.Volume{
Name: k8stools.SanitizeVolumeName("secret-" + s),
diff --git a/internal/controller/operator/factory/vtcluster/vmauth_lb.go b/internal/controller/operator/factory/vtcluster/vmauth_lb.go
index 245a2eff66..e7247f2940 100644
--- a/internal/controller/operator/factory/vtcluster/vmauth_lb.go
+++ b/internal/controller/operator/factory/vtcluster/vmauth_lb.go
@@ -64,11 +64,11 @@ func createOrUpdateVMAuthLB(ctx context.Context, rclient client.Client, cr, prev
}
}
if cr.Spec.RequestsLoadBalancer.Spec.NetworkPolicy != nil {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
np := build.NetworkPolicy(b, cr.Spec.RequestsLoadBalancer.Spec.NetworkPolicy)
var prevNP *networkingv1.NetworkPolicy
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.NetworkPolicy != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevNP = build.NetworkPolicy(b, prevCR.Spec.RequestsLoadBalancer.Spec.NetworkPolicy)
}
owner := cr.AsOwner()
@@ -86,7 +86,7 @@ func createOrUpdateVMAuthLBHPA(ctx context.Context, rclient client.Client, cr, p
if cr.Spec.RequestsLoadBalancer.Spec.HPA == nil {
return nil
}
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
targetRef := autoscalingv2.CrossVersionObjectReference{
Name: b.PrefixedName(),
Kind: "Deployment",
@@ -95,7 +95,7 @@ func createOrUpdateVMAuthLBHPA(ctx context.Context, rclient client.Client, cr, p
newHPA := build.HPA(b, targetRef, cr.Spec.RequestsLoadBalancer.Spec.HPA)
var prevHPA *autoscalingv2.HorizontalPodAutoscaler
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.HPA != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevHPA = build.HPA(b, targetRef, prevCR.Spec.RequestsLoadBalancer.Spec.HPA)
}
owner := cr.AsOwner()
@@ -122,13 +122,13 @@ func buildVMauthLBSecret(cr *vmv1.VTCluster) *corev1.Secret {
insertProto := "http"
selectProto := "http"
if cr.Spec.Select != nil {
- selectPort = cr.Spec.Select.Port
+ selectPort = cr.Spec.Select.PrimaryPort(cr.Spec.Select.Port)
if cr.Spec.Select.UseTLS() {
selectProto = "https"
}
}
if cr.Spec.Insert != nil {
- insertPort = cr.Spec.Insert.Port
+ insertPort = cr.Spec.Insert.PrimaryPort(cr.Spec.Insert.Port)
if cr.Spec.Insert.UseTLS() {
insertProto = "https"
}
@@ -277,6 +277,9 @@ func buildVMAuthScrape(cr *vmv1.VTCluster, svc *corev1.Service) *vmv1beta1.VMSer
return nil
}
svs := build.VMServiceScrape(svc, &cr.Spec.RequestsLoadBalancer.Spec)
+ if svs == nil {
+ return nil
+ }
if svs.Spec.Selector.MatchLabels == nil {
svs.Spec.Selector.MatchLabels = make(map[string]string)
}
@@ -285,8 +288,8 @@ func buildVMAuthScrape(cr *vmv1.VTCluster, svc *corev1.Service) *vmv1beta1.VMSer
}
func createOrUpdateVMAuthLBService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VTCluster) error {
- builder := func(r *vmv1.VTCluster) *build.ChildBuilder {
- b := build.NewChildBuilder(r, vmv1beta1.ClusterComponentBalancer)
+ builder := func(r *vmv1.VTCluster) *vmv1beta1.ChildBuilder {
+ b := vmv1beta1.NewChildBuilder(r, vmv1beta1.ClusterComponentBalancer)
b.SetFinalLabels(labels.Merge(b.FinalLabels(), map[string]string{
vmv1beta1.VMAuthLBServiceProxyTargetLabel: "vmauth",
}))
@@ -314,11 +317,11 @@ func createOrUpdateVMAuthLBService(ctx context.Context, rclient client.Client, c
}
func createOrUpdatePodDisruptionBudgetForVMAuthLB(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VTCluster) error {
- b := build.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
+ b := vmv1beta1.NewChildBuilder(cr, vmv1beta1.ClusterComponentBalancer)
pdb := build.PodDisruptionBudget(b, cr.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget)
var prevPDB *policyv1.PodDisruptionBudget
if prevCR != nil && prevCR.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget != nil {
- b = build.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
+ b = vmv1beta1.NewChildBuilder(prevCR, vmv1beta1.ClusterComponentBalancer)
prevPDB = build.PodDisruptionBudget(b, prevCR.Spec.RequestsLoadBalancer.Spec.PodDisruptionBudget)
}
owner := cr.AsOwner()
@@ -327,8 +330,8 @@ func createOrUpdatePodDisruptionBudgetForVMAuthLB(ctx context.Context, rclient c
// createOrUpdateLBProxyService builds vtinsert and vtselect external services to expose vtcluster components for access by vmauth
func createOrUpdateLBProxyService(ctx context.Context, rclient client.Client, cr, prevCR *vmv1.VTCluster, kind vmv1beta1.ClusterComponent, port, prevPort string) error {
- builder := func(r *vmv1.VTCluster) *build.ChildBuilder {
- b := build.NewChildBuilder(r, kind)
+ builder := func(r *vmv1.VTCluster) *vmv1beta1.ChildBuilder {
+ b := vmv1beta1.NewChildBuilder(r, kind)
b.SetFinalLabels(labels.Merge(b.FinalLabels(), map[string]string{
vmv1beta1.VMAuthLBServiceProxyTargetLabel: string(kind),
}))
diff --git a/internal/controller/operator/factory/vtcluster/vtcluster_reconcile_test.go b/internal/controller/operator/factory/vtcluster/vtcluster_reconcile_test.go
index 4e8698e377..535055a0ac 100644
--- a/internal/controller/operator/factory/vtcluster/vtcluster_reconcile_test.go
+++ b/internal/controller/operator/factory/vtcluster/vtcluster_reconcile_test.go
@@ -82,18 +82,24 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
ObjectMeta: objectMeta,
Spec: vmv1.VTClusterSpec{
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -140,19 +146,25 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
ObjectMeta: objectMeta,
Spec: vmv1.VTClusterSpec{
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
RollingUpdateStrategy: appsv1.RollingUpdateStatefulSetStrategyType,
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -250,18 +262,24 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
Spec: vmv1.VTClusterSpec{
Paused: true,
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -317,13 +335,25 @@ func TestCreateOrUpdate_LBDeploymentWithHPA(t *testing.T) {
},
},
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To(int32(0))},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vtsingle/vtsingle.go b/internal/controller/operator/factory/vtsingle/vtsingle.go
index cf32635ed2..2ddd4b10cd 100644
--- a/internal/controller/operator/factory/vtsingle/vtsingle.go
+++ b/internal/controller/operator/factory/vtsingle/vtsingle.go
@@ -12,7 +12,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/utils/ptr"
@@ -212,7 +211,6 @@ func makePodSpec(r *vmv1.VTSingle) (*corev1.PodTemplateSpec, error) {
args = append(args, "-logIngestedRows")
}
cfg := config.MustGetBaseConfig()
- args = append(args, fmt.Sprintf("-httpListenAddr=:%s", r.Spec.Port))
if cfg.EnableTCP6 {
args = append(args, "-enableTCP6")
}
@@ -224,8 +222,7 @@ func makePodSpec(r *vmv1.VTSingle) (*corev1.PodTemplateSpec, error) {
var envs []corev1.EnvVar
envs = append(envs, r.Spec.ExtraEnvs...)
- var ports []corev1.ContainerPort
- ports = append(ports, corev1.ContainerPort{Name: "http", Protocol: "TCP", ContainerPort: intstr.Parse(r.Spec.Port).IntVal})
+ ports := build.AddHTTPListenerPortsTo(nil, r.Spec.HTTPListeners)
ports = build.AddOTLPGRPCPortTo(ports, r.Spec.GRPCSpec)
var pvcSrc *corev1.PersistentVolumeClaimVolumeSource
if !isStorageEmpty(r.Spec.Storage) {
@@ -273,6 +270,8 @@ func makePodSpec(r *vmv1.VTSingle) (*corev1.PodTemplateSpec, error) {
})
}
+ args = build.AddHTTPListenerArgsTo(args, r.Spec.HTTPListeners, tlsServerConfigMountPath)
+ volumes, vmMounts = build.AddHTTPListenerTLSToVolumes(volumes, vmMounts, r.Spec.HTTPListeners, tlsServerConfigMountPath)
args = build.AddExtraArgsOverrideDefaults(args, r.Spec.ExtraArgs, "-")
sort.Strings(args)
vtsingleContainer := corev1.Container{
@@ -330,11 +329,13 @@ func createOrUpdateService(ctx context.Context, rclient client.Client, cr, prevC
if prevCR != nil {
prevSvc = build.Service(prevCR, prevCR.Spec.Port, func(svc *corev1.Service) {
build.AddOTLPGRPCPortToService(svc, prevCR.Spec.GRPCSpec)
+ build.AddHTTPListenerPortsToService(svc, prevCR.Spec.HTTPListeners)
})
prevAdditionalSvc = build.AdditionalServiceFromDefault(prevSvc, prevCR.Spec.ServiceSpec)
}
svc := build.Service(cr, cr.Spec.Port, func(svc *corev1.Service) {
build.AddOTLPGRPCPortToService(svc, cr.Spec.GRPCSpec)
+ build.AddHTTPListenerPortsToService(svc, cr.Spec.HTTPListeners)
})
if err := cr.Spec.ServiceSpec.IsSomeAndThen(func(s *vmv1beta1.AdditionalServiceSpec) error {
additionalService := build.AdditionalServiceFromDefault(svc, s)
diff --git a/internal/controller/operator/factory/vtsingle/vtsingle_reconcile_test.go b/internal/controller/operator/factory/vtsingle/vtsingle_reconcile_test.go
index 9f6aef65ea..3d6333405b 100644
--- a/internal/controller/operator/factory/vtsingle/vtsingle_reconcile_test.go
+++ b/internal/controller/operator/factory/vtsingle/vtsingle_reconcile_test.go
@@ -105,8 +105,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
cr: &vmv1.VTSingle{
ObjectMeta: objectMeta,
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -127,8 +129,10 @@ func Test_CreateOrUpdate_Actions(t *testing.T) {
cr: &vmv1.VTSingle{
ObjectMeta: objectMeta,
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -159,9 +163,11 @@ func TestCreateOrUpdate_Paused(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Paused: true,
+ },
},
},
}
diff --git a/internal/controller/operator/factory/vtsingle/vtsingle_test.go b/internal/controller/operator/factory/vtsingle/vtsingle_test.go
index 884f24b56d..7cef2ba067 100644
--- a/internal/controller/operator/factory/vtsingle/vtsingle_test.go
+++ b/internal/controller/operator/factory/vtsingle/vtsingle_test.go
@@ -67,8 +67,10 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ },
},
},
},
@@ -98,9 +100,11 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Port: "10435",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Port: "10435",
+ },
},
},
},
@@ -130,9 +134,11 @@ func TestCreateOrUpdate(t *testing.T) {
Namespace: "default",
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(1)),
- Port: "10435",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(1)),
+ Port: "10435",
+ },
},
},
},
@@ -252,7 +258,9 @@ func TestMakePodSpec_GRPC(t *testing.T) {
cr := &vmv1.VTSingle{
ObjectMeta: metav1.ObjectMeta{Name: "traces-1", Namespace: "default"},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10428"},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{Port: "10428"},
+ },
GRPCSpec: &vmv1.OTLPGRPCSpec{
ListenPort: 4317,
TLSConfig: &vmv1.TLSServerConfig{
@@ -285,7 +293,7 @@ func TestMakePodSpec_GRPC(t *testing.T) {
assert.Equal(t, "/etc/vm/tls-server-secrets/tls", m.MountPath)
}
}
- assert.True(t, found, "expected secret-tls-tls volume mount")
+ assert.True(t, found, "expected tls-tls volume mount")
}
func TestCreateOrUpdateService(t *testing.T) {
diff --git a/internal/controller/operator/reconcile_and_track_status_test.go b/internal/controller/operator/reconcile_and_track_status_test.go
index 769f5375f1..0505ef7e00 100644
--- a/internal/controller/operator/reconcile_and_track_status_test.go
+++ b/internal/controller/operator/reconcile_and_track_status_test.go
@@ -133,7 +133,11 @@ func TestReconcileAndTrackStatus(t *testing.T) {
pausedSpec := vmv1beta1.VMAlertSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{Paused: true},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Paused: true,
+ },
+ },
}
// object created as paused: callback not called, status set to paused
f(opts{
diff --git a/internal/converter/converter_test.go b/internal/converter/converter_test.go
index b1016cd43c..f7b06605be 100644
--- a/internal/converter/converter_test.go
+++ b/internal/converter/converter_test.go
@@ -1027,14 +1027,16 @@ func TestConvertVLAgent(t *testing.T) {
Namespace: "test-ns",
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/victoria-logs",
- Tag: "v0.3.2",
- },
- ReplicaCount: ptr.To(int32(1)),
- ExtraArgs: map[string]string{
- "remoteWrite.maxDiskUsagePerURL": "1GiB",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/victoria-logs",
+ Tag: "v0.3.2",
+ },
+ ReplicaCount: ptr.To(int32(1)),
+ ExtraArgs: map[string]string{
+ "remoteWrite.maxDiskUsagePerURL": "1GiB",
+ },
},
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
@@ -1093,30 +1095,36 @@ func TestConvertVLCluster(t *testing.T) {
},
Spec: vmv1.VLClusterSpec{
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/victoria-logs",
- Tag: "v0.3.2",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/victoria-logs",
+ Tag: "v0.3.2",
+ },
+ ReplicaCount: ptr.To(int32(2)),
},
- ReplicaCount: ptr.To(int32(2)),
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/victoria-logs",
- Tag: "v0.3.2",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/victoria-logs",
+ Tag: "v0.3.2",
+ },
+ ReplicaCount: ptr.To(int32(2)),
},
- ReplicaCount: ptr.To(int32(2)),
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/victoria-logs",
- Tag: "v0.3.2",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/victoria-logs",
+ Tag: "v0.3.2",
+ },
+ ReplicaCount: ptr.To(int32(2)),
},
- ReplicaCount: ptr.To(int32(2)),
},
},
},
@@ -1173,21 +1181,27 @@ func TestConvertVLCluster(t *testing.T) {
},
Spec: vmv1.VLClusterSpec{
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Volumes: extraVolumes,
- VolumeMounts: extraVolumeMounts,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Volumes: extraVolumes,
+ VolumeMounts: extraVolumeMounts,
+ },
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Volumes: extraVolumes,
- VolumeMounts: extraVolumeMounts,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Volumes: extraVolumes,
+ VolumeMounts: extraVolumeMounts,
+ },
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Volumes: extraVolumes,
- VolumeMounts: extraVolumeMounts,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Volumes: extraVolumes,
+ VolumeMounts: extraVolumeMounts,
+ },
},
},
},
@@ -1230,10 +1244,12 @@ func TestConvertVLCollector(t *testing.T) {
Namespace: "test-ns",
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/vlagent",
- Tag: "v0.3.2",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/vlagent",
+ Tag: "v0.3.2",
+ },
},
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
@@ -1325,12 +1341,14 @@ func TestConvertVTSingle(t *testing.T) {
Namespace: "test-ns",
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/victoria-traces",
- Tag: "v0.3.2",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/victoria-traces",
+ Tag: "v0.3.2",
+ },
+ ReplicaCount: ptr.To(int32(1)),
},
- ReplicaCount: ptr.To(int32(1)),
},
RetentionPeriod: "14d",
},
@@ -1386,30 +1404,36 @@ func TestConvertVTCluster(t *testing.T) {
},
Spec: vmv1.VTClusterSpec{
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/victoria-traces",
- Tag: "v0.3.2",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/victoria-traces",
+ Tag: "v0.3.2",
+ },
+ ReplicaCount: ptr.To(int32(2)),
},
- ReplicaCount: ptr.To(int32(2)),
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/victoria-traces",
- Tag: "v0.3.2",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/victoria-traces",
+ Tag: "v0.3.2",
+ },
+ ReplicaCount: ptr.To(int32(2)),
},
- ReplicaCount: ptr.To(int32(2)),
},
},
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/victoria-traces",
- Tag: "v0.3.2",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/victoria-traces",
+ Tag: "v0.3.2",
+ },
+ ReplicaCount: ptr.To(int32(2)),
},
- ReplicaCount: ptr.To(int32(2)),
},
},
},
@@ -1447,12 +1471,14 @@ func TestConvertVMAuth(t *testing.T) {
Namespace: "test-ns",
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Repository: "victoriametrics/vmauth",
- Tag: "v1.100.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Repository: "victoriametrics/vmauth",
+ Tag: "v1.100.0",
+ },
+ ReplicaCount: ptr.To(int32(1)),
},
- ReplicaCount: ptr.To(int32(1)),
},
},
}
diff --git a/internal/podutil/util.go b/internal/podutil/util.go
index 90c9d980fc..72a817937c 100644
--- a/internal/podutil/util.go
+++ b/internal/podutil/util.go
@@ -15,6 +15,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
vmv1alpha1 "github.com/VictoriaMetrics/operator/api/operator/v1alpha1"
+ vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/build"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/k8stools"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/logger"
@@ -26,7 +27,7 @@ type AgentMetrics interface {
client.Object
PrefixedName() string
GetMetricsPath() string
- ProbeScheme() string
+ Params(vmv1beta1.ParamsKind) *vmv1beta1.StandardAppsParams
}
// GetMetricsAddrs discovers the agent's active endpoints from EndpointSlices and
@@ -43,6 +44,7 @@ func GetMetricsAddrs(ctx context.Context, rclient client.Client, agent AgentMetr
if len(esl.Items) == 0 {
return nil
}
+ scheme := strings.ToLower(agent.Params(vmv1beta1.ScrapeParamsKind).ProbeScheme())
addrs := sets.New[string]()
for i := range esl.Items {
es := &esl.Items[i]
@@ -69,7 +71,7 @@ func GetMetricsAddrs(ctx context.Context, rclient client.Client, agent AgentMetr
}
u := &url.URL{
Host: host,
- Scheme: strings.ToLower(agent.ProbeScheme()),
+ Scheme: scheme,
Path: agent.GetMetricsPath(),
}
addrs.Insert(u.String())
diff --git a/test/e2e/childobjects/vmrule_test.go b/test/e2e/childobjects/vmrule_test.go
index cd6e66b804..048e50e84d 100644
--- a/test/e2e/childobjects/vmrule_test.go
+++ b/test/e2e/childobjects/vmrule_test.go
@@ -91,9 +91,11 @@ var _ = Describe("test vmrule Controller", Label("vm", "child", "alert"), func()
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ExtraArgs: map[string]string{
- "notifier.url": "http://test",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: map[string]string{
+ "notifier.url": "http://test",
+ },
},
},
},
@@ -148,9 +150,11 @@ var _ = Describe("test vmrule Controller", Label("vm", "child", "alert"), func()
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ExtraArgs: map[string]string{
- "notifier.url": "http://test",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: map[string]string{
+ "notifier.url": "http://test",
+ },
},
},
},
@@ -252,9 +256,11 @@ var _ = Describe("test vmrule Controller", Label("vm", "child", "alert"), func()
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ExtraArgs: map[string]string{
- "notifier.url": "http://test",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: map[string]string{
+ "notifier.url": "http://test",
+ },
},
},
},
diff --git a/test/e2e/childobjects/vmuser_test.go b/test/e2e/childobjects/vmuser_test.go
index c78ca1d73b..b7e9d31df6 100644
--- a/test/e2e/childobjects/vmuser_test.go
+++ b/test/e2e/childobjects/vmuser_test.go
@@ -89,9 +89,11 @@ var _ = Describe("test vmuser Controller", Label("vm", "child", "auth"), func()
},
Spec: vmv1beta1.VMAuthSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.108.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.108.0",
+ },
},
},
},
@@ -139,9 +141,11 @@ var _ = Describe("test vmuser Controller", Label("vm", "child", "auth"), func()
},
Spec: vmv1beta1.VMAuthSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Image: vmv1beta1.Image{
- Tag: "v1.108.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Image: vmv1beta1.Image{
+ Tag: "v1.108.0",
+ },
},
},
},
diff --git a/test/e2e/upgrade/upgrade_test.go b/test/e2e/upgrade/upgrade_test.go
index 74b1d15521..dec193e7e4 100644
--- a/test/e2e/upgrade/upgrade_test.go
+++ b/test/e2e/upgrade/upgrade_test.go
@@ -62,13 +62,15 @@ var (
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: configReloaderImage(),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmagent",
- Tag: "v1.136.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmagent",
+ Tag: "v1.136.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
}
@@ -79,23 +81,25 @@ var (
URL: "http://127.0.0.1:9428/insert/loki/api/v1/push",
},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vlagent",
- Tag: "v1.48.0",
- },
- Resources: corev1.ResourceRequirements{
- Requests: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("20m"),
- corev1.ResourceMemory: resource.MustParse("128Mi"),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vlagent",
+ Tag: "v1.48.0",
},
- Limits: corev1.ResourceList{
- corev1.ResourceCPU: resource.MustParse("20m"),
- corev1.ResourceMemory: resource.MustParse("128Mi"),
+ Resources: corev1.ResourceRequirements{
+ Requests: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("20m"),
+ corev1.ResourceMemory: resource.MustParse("128Mi"),
+ },
+ Limits: corev1.ResourceList{
+ corev1.ResourceCPU: resource.MustParse("20m"),
+ corev1.ResourceMemory: resource.MustParse("128Mi"),
+ },
},
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
}
@@ -120,13 +124,15 @@ var (
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: configReloaderImage(),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmauth",
- Tag: "v1.136.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmauth",
+ Tag: "v1.136.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
UnauthorizedAccessConfig: []vmv1beta1.UnauthorizedAccessConfigURLMap{
{
@@ -152,46 +158,54 @@ var (
},
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-traces",
- Tag: "v0.4.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-traces",
+ Tag: "v0.4.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-traces",
- Tag: "v0.4.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-traces",
+ Tag: "v0.4.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
Storage: &vmv1.VTStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-traces",
- Tag: "v0.4.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-traces",
+ Tag: "v0.4.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
},
}
vtsingle = &vmv1.VTSingle{
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-traces",
- Tag: "v0.4.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-traces",
+ Tag: "v0.4.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
}
@@ -200,13 +214,15 @@ var (
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: configReloaderImage(),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-metrics",
- Tag: "v1.136.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-metrics",
+ Tag: "v1.136.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
}
@@ -215,13 +231,15 @@ var (
CommonConfigReloaderParams: vmv1beta1.CommonConfigReloaderParams{
ConfigReloaderImage: configReloaderImage(),
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmalert",
- Tag: "v1.136.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmalert",
+ Tag: "v1.136.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
@@ -248,33 +266,39 @@ var (
},
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-logs",
- Tag: "v1.44.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-logs",
+ Tag: "v1.44.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-logs",
- Tag: "v1.44.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-logs",
+ Tag: "v1.44.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-logs",
- Tag: "v1.44.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-logs",
+ Tag: "v1.44.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
},
@@ -295,33 +319,39 @@ var (
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmselect",
- Tag: "v1.136.0-cluster",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmselect",
+ Tag: "v1.136.0-cluster",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vminsert",
- Tag: "v1.136.0-cluster",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vminsert",
+ Tag: "v1.136.0-cluster",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmstorage",
- Tag: "v1.136.0-cluster",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmstorage",
+ Tag: "v1.136.0-cluster",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
},
@@ -343,13 +373,15 @@ var (
}
vlsingle = &vmv1.VLSingle{
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/victoria-logs",
- Tag: "v1.44.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/victoria-logs",
+ Tag: "v1.44.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
}
@@ -357,13 +389,15 @@ var (
Spec: vmv1alpha1.VMDistributedSpec{
VMAuth: vmv1alpha1.VMDistributedAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmauth",
- Tag: "v1.136.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmauth",
+ Tag: "v1.136.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
},
@@ -374,46 +408,54 @@ var (
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmselect",
- Tag: "v1.136.0-cluster",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmselect",
+ Tag: "v1.136.0-cluster",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vminsert",
- Tag: "v1.136.0-cluster",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vminsert",
+ Tag: "v1.136.0-cluster",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmstorage",
- Tag: "v1.136.0-cluster",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmstorage",
+ Tag: "v1.136.0-cluster",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
},
},
VMAgent: vmv1alpha1.VMDistributedZoneAgent{
Spec: vmv1alpha1.VMDistributedZoneAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Image: vmv1beta1.Image{
- Repository: "quay.io/victoriametrics/vmagent",
- Tag: "v1.136.0",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Image: vmv1beta1.Image{
+ Repository: "quay.io/victoriametrics/vmagent",
+ Tag: "v1.136.0",
+ },
+ TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
- TerminationGracePeriodSeconds: ptr.To(int64(1)),
},
},
},
diff --git a/test/e2e/utils_test.go b/test/e2e/utils_test.go
index fd4116e089..d55165378e 100644
--- a/test/e2e/utils_test.go
+++ b/test/e2e/utils_test.go
@@ -258,6 +258,30 @@ func hasVolumeMount(volumeMounts []corev1.VolumeMount, volumeMountName string) e
return fmt.Errorf("volumes mounts=%d with paths=%s; must have=%s", len(volumeMounts), strings.Join(existVolumes, ","), volumeMountName)
}
+func checkContainerPort(ports []corev1.ContainerPort, name string, wantPort int32) {
+ GinkgoHelper()
+ var found bool
+ for _, p := range ports {
+ if p.Name == name {
+ found = true
+ Expect(p.ContainerPort).To(Equal(wantPort))
+ }
+ }
+ Expect(found).To(BeTrue(), "expected a container port named %q", name)
+}
+
+func checkServicePort(ports []corev1.ServicePort, name string, wantPort int32) {
+ GinkgoHelper()
+ var found bool
+ for _, p := range ports {
+ if p.Name == name {
+ found = true
+ Expect(p.Port).To(Equal(wantPort))
+ }
+ }
+ Expect(found).To(BeTrue(), "expected a service port named %q", name)
+}
+
//nolint:dupl,lll
func mustGetFirstPod(ctx context.Context, rclient client.Client, obj client.Object) *corev1.Pod {
GinkgoHelper()
@@ -342,8 +366,10 @@ func createVMAuth(ctx context.Context, wg *sync.WaitGroup, k8sClient client.Clie
Name: name,
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
UserSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
diff --git a/test/e2e/vlagent_test.go b/test/e2e/vlagent_test.go
index 3ada4b99a8..c17e601c03 100644
--- a/test/e2e/vlagent_test.go
+++ b/test/e2e/vlagent_test.go
@@ -63,8 +63,10 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://localhost:9428/internal/insert"},
@@ -101,8 +103,10 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://localhost:9428"},
@@ -134,8 +138,10 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
Storage: &vmv1beta1.StorageSpec{
VolumeClaimTemplate: vmv1beta1.EmbeddedPersistentVolumeClaim{
@@ -224,8 +230,10 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{
@@ -336,10 +344,12 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseStrictSecurity: ptr.To(true),
- ReplicaCount: ptr.To[int32](1),
- DisableAutomountServiceAccountToken: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(true),
+ ReplicaCount: ptr.To[int32](1),
+ DisableAutomountServiceAccountToken: true,
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://localhost:9428"},
@@ -380,10 +390,12 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{{URL: "http://localhost:9428/internal/insert"}},
@@ -392,6 +404,38 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
nil,
func(cr *vmv1.VLAgent) {},
),
+ Entry("with httpListeners", "http-listeners",
+ &vmv1.VLAgent{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ Name: nsn.Name,
+ },
+ Spec: vmv1.VLAgentSpec{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":9430", Primary: true},
+ {Name: "web2", Addr: ":9431"},
+ },
+ },
+ RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{{URL: "http://localhost:9428/internal/insert"}},
+ },
+ },
+ nil,
+ func(cr *vmv1.VLAgent) {
+ var sts appsv1.StatefulSet
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cr.PrefixedName(), Namespace: namespace}, &sts)).ToNot(HaveOccurred())
+ checkContainerPort(sts.Spec.Template.Spec.Containers[0].Ports, "web", 9430)
+ checkContainerPort(sts.Spec.Template.Spec.Containers[0].Ports, "web2", 9431)
+
+ var svc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cr.PrefixedName(), Namespace: namespace}, &svc)).ToNot(HaveOccurred())
+ checkServicePort(svc.Spec.Ports, "web", 9430)
+ checkServicePort(svc.Spec.Ports, "web2", 9431)
+ },
+ ),
)
type testStep struct {
setup func(*vmv1.VLAgent)
@@ -427,8 +471,10 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Entry("by scaling replicas to to 3", "update-replicas-3",
&vmv1.VLAgent{
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://some-vl-single:9428"},
@@ -451,9 +497,11 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
),
Entry("by deleting and restoring PodDisruptionBudget and podScrape", "pdb-mutations-scrape",
&vmv1.VLAgent{Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](2),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](2),
+ },
},
PodDisruptionBudget: &vmv1beta1.EmbeddedPodDisruptionBudgetSpec{MaxUnavailable: &intstr.IntOrString{IntVal: 1}},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
@@ -493,9 +541,11 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
),
Entry("by transition into logs collection and back", "logs-collection-transition",
&vmv1.VLAgent{Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](2),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](2),
+ },
},
PodDisruptionBudget: &vmv1beta1.EmbeddedPodDisruptionBudgetSpec{MaxUnavailable: &intstr.IntOrString{IntVal: 1}},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
@@ -535,8 +585,10 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://localhost:9428/internal/insert"},
@@ -559,8 +611,10 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://localhost:9428/internal/insert"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -588,8 +642,10 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://localhost:9428/internal/insert"},
@@ -620,9 +676,11 @@ var _ = Describe("test vlagent Controller", Label("vl", "agent", "vlagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Paused: true,
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://localhost:9428/internal/insert"},
diff --git a/test/e2e/vlcluster_test.go b/test/e2e/vlcluster_test.go
index df0cbd07dd..8f467a29c0 100644
--- a/test/e2e/vlcluster_test.go
+++ b/test/e2e/vlcluster_test.go
@@ -48,8 +48,10 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
VLSelect: &vmv1.VLSelect{},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -75,25 +77,31 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
},
Spec: vmv1.VLClusterSpec{
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
@@ -114,8 +122,10 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
VLSelect: &vmv1.VLSelect{},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -131,6 +141,65 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
Expect(svc.Spec.Selector).To(Equal(cr.SelectorLabels(vmv1beta1.ClusterComponentBalancer)))
},
),
+ Entry("with httpListeners on all components", "http-listeners",
+ &vmv1.VLCluster{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ },
+ Spec: vmv1.VLClusterSpec{
+ VLInsert: &vmv1.VLInsert{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":9481", Primary: true},
+ {Name: "web2", Addr: ":9482"},
+ },
+ },
+ },
+ VLSelect: &vmv1.VLSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":9471", Primary: true},
+ },
+ },
+ },
+ VLStorage: &vmv1.VLStorage{
+ RetentionPeriod: "1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":9491", Primary: true},
+ },
+ },
+ },
+ },
+ },
+ func(cr *vmv1.VLCluster) {
+ var insertDep appsv1.Deployment
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentInsert)}, &insertDep)).ToNot(HaveOccurred())
+ checkContainerPort(insertDep.Spec.Template.Spec.Containers[0].Ports, "web", 9481)
+ checkContainerPort(insertDep.Spec.Template.Spec.Containers[0].Ports, "web2", 9482)
+ var insertSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentInsert)}, &insertSvc)).ToNot(HaveOccurred())
+ checkServicePort(insertSvc.Spec.Ports, "web", 9481)
+ checkServicePort(insertSvc.Spec.Ports, "web2", 9482)
+
+ var selectDep appsv1.Deployment
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentSelect)}, &selectDep)).ToNot(HaveOccurred())
+ checkContainerPort(selectDep.Spec.Template.Spec.Containers[0].Ports, "web", 9471)
+ var selectSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentSelect)}, &selectSvc)).ToNot(HaveOccurred())
+ checkServicePort(selectSvc.Spec.Ports, "web", 9471)
+
+ var storageSts appsv1.StatefulSet
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentStorage)}, &storageSts)).ToNot(HaveOccurred())
+ checkContainerPort(storageSts.Spec.Template.Spec.Containers[0].Ports, "web", 9491)
+ var storageSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentStorage)}, &storageSvc)).ToNot(HaveOccurred())
+ checkServicePort(storageSvc.Spec.Ports, "web", 9491)
+ },
+ ),
)
type testStep struct {
@@ -378,8 +447,10 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
modify: func(cr *vmv1.VLCluster) {
By("upscaling vlselect, removing vlinsert", func() {
cr.Spec.VLSelect = &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
},
}
cr.Spec.VLInsert = nil
@@ -404,13 +475,17 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
modify: func(cr *vmv1.VLCluster) {
By("downscaling all components to 0 replicas", func() {
cr.Spec.VLSelect = &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
}
cr.Spec.VLInsert = &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
}
cr.Spec.VLStorage.ReplicaCount = ptr.To(int32(0))
@@ -449,8 +524,10 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
VLSelect: &vmv1.VLSelect{},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -469,19 +546,25 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
},
Spec: vmv1.VLClusterSpec{
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -514,8 +597,10 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
VLSelect: &vmv1.VLSelect{},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -549,8 +634,10 @@ var _ = Describe("test vlcluster Controller", Label("vl", "cluster", "vlcluster"
VLSelect: &vmv1.VLSelect{},
VLStorage: &vmv1.VLStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
diff --git a/test/e2e/vldistributed_test.go b/test/e2e/vldistributed_test.go
index dd980ba46d..59a7e85ee8 100644
--- a/test/e2e/vldistributed_test.go
+++ b/test/e2e/vldistributed_test.go
@@ -32,13 +32,19 @@ func genVLClusterSpec(opts ...func(*vmv1.VLClusterSpec)) vmv1.VLClusterSpec {
s := vmv1.VLClusterSpec{
VLSelect: &vmv1.VLSelect{
- CommonAppsParams: commonAppsParams,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: commonAppsParams,
+ },
},
VLInsert: &vmv1.VLInsert{
- CommonAppsParams: noReplicas,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: noReplicas,
+ },
},
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: commonAppsParams,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: commonAppsParams,
+ },
},
}
for _, opt := range opts {
@@ -66,8 +72,10 @@ func createVLClusters(ctx context.Context, wg *sync.WaitGroup, k8sClient client.
func genVLAgentSpec() vmv1.VLAgentSpec {
return vmv1.VLAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{
{URL: "http://localhost"},
@@ -155,8 +163,10 @@ var _ = Describe("e2e VLDistributed", Label("vl", "vldistributed"), func() {
UpdatePause: &metav1.Duration{Duration: 1 * time.Second},
VLAgent: vmv1alpha1.VLDistributedZoneAgent{
Spec: vmv1alpha1.VLDistributedZoneAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](2),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](2),
+ },
},
},
},
@@ -332,8 +342,10 @@ var _ = Describe("e2e VLDistributed", Label("vl", "vldistributed"), func() {
VMAuth: vmv1alpha1.VLDistributedAuth{
Name: nsn.Name,
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -679,8 +691,10 @@ var _ = Describe("e2e VLDistributed", Label("vl", "vldistributed"), func() {
VLInsert: cr.Spec.Zones[0].VLCluster.Spec.VLInsert,
VLSelect: cr.Spec.Zones[0].VLCluster.Spec.VLSelect,
VLStorage: &vmv1.VLStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](initialReplicas + 1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](initialReplicas + 1),
+ },
},
},
}
@@ -885,9 +899,21 @@ var _ = Describe("e2e VLDistributed", Label("vl", "vldistributed"), func() {
zonesCount := 2
clusterSpec := vmv1.VLClusterSpec{
- VLSelect: &vmv1.VLSelect{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)}},
- VLInsert: &vmv1.VLInsert{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)}},
- VLStorage: &vmv1.VLStorage{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)}},
+ VLSelect: &vmv1.VLSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ },
+ },
+ VLInsert: &vmv1.VLInsert{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ },
+ },
+ VLStorage: &vmv1.VLStorage{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ },
+ },
}
zs := make([]vmv1alpha1.VLDistributedZone, zonesCount)
@@ -1068,8 +1094,10 @@ var _ = Describe("e2e VLDistributed", Label("vl", "vldistributed"), func() {
VMAuth: vmv1alpha1.VLDistributedAuth{
Name: nsn.Name,
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
diff --git a/test/e2e/vlsingle_test.go b/test/e2e/vlsingle_test.go
index cd94f56cf1..e936b1c809 100644
--- a/test/e2e/vlsingle_test.go
+++ b/test/e2e/vlsingle_test.go
@@ -59,9 +59,11 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
Namespace: namespace,
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- UseStrictSecurity: ptr.To(true),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ UseStrictSecurity: ptr.To(true),
+ },
},
RetentionPeriod: "1",
Storage: &corev1.PersistentVolumeClaimSpec{
@@ -89,9 +91,11 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
Namespace: namespace,
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- UseStrictSecurity: ptr.To(false),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ UseStrictSecurity: ptr.To(false),
+ },
},
RetentionPeriod: "1",
},
@@ -111,29 +115,31 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
Namespace: namespace,
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Volumes: []corev1.Volume{
- {
- Name: "data",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Volumes: []corev1.Volume{
+ {
+ Name: "data",
+ VolumeSource: corev1.VolumeSource{
+ EmptyDir: &corev1.EmptyDirVolumeSource{},
+ },
},
- },
- {
- Name: "unused",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
+ {
+ Name: "unused",
+ VolumeSource: corev1.VolumeSource{
+ EmptyDir: &corev1.EmptyDirVolumeSource{},
+ },
},
},
- },
- VolumeMounts: []corev1.VolumeMount{
- {
- Name: "unused",
- MountPath: "/opt/unused/mountpoint",
+ VolumeMounts: []corev1.VolumeMount{
+ {
+ Name: "unused",
+ MountPath: "/opt/unused/mountpoint",
+ },
},
+ UseStrictSecurity: ptr.To(false),
},
- UseStrictSecurity: ptr.To(false),
},
RetentionPeriod: "1",
StorageDataPath: "/custom-path/internal/dir",
@@ -157,10 +163,12 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
Namespace: namespace,
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
RetentionPeriod: "1",
@@ -168,6 +176,36 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
},
func(cr *vmv1.VLSingle) {},
),
+ Entry("with httpListeners", "http-listeners",
+ &vmv1.VLSingle{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ },
+ Spec: vmv1.VLSingleSpec{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(false),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":9420", Primary: true},
+ {Name: "web2", Addr: ":9422"},
+ },
+ },
+ RetentionPeriod: "1",
+ },
+ },
+ func(cr *vmv1.VLSingle) {
+ createdChildObjects := types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName()}
+ var createdDeploy appsv1.Deployment
+ Expect(k8sClient.Get(ctx, createdChildObjects, &createdDeploy)).ToNot(HaveOccurred())
+ checkContainerPort(createdDeploy.Spec.Template.Spec.Containers[0].Ports, "web", 9420)
+ checkContainerPort(createdDeploy.Spec.Template.Spec.Containers[0].Ports, "web2", 9422)
+
+ var svc corev1.Service
+ Expect(k8sClient.Get(ctx, createdChildObjects, &svc)).ToNot(HaveOccurred())
+ checkServicePort(svc.Spec.Ports, "web", 9420)
+ checkServicePort(svc.Spec.Ports, "web2", 9422)
+ }),
)
baseVLSingle := &vmv1.VLSingle{
@@ -176,8 +214,10 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
},
Spec: vmv1.VLSingleSpec{
RetentionPeriod: "10",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -331,8 +371,10 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
Name: nsn.Name,
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -350,8 +392,10 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
Name: nsn.Name,
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -380,8 +424,10 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
Name: nsn.Name,
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -410,9 +456,11 @@ var _ = Describe("test vlsingle Controller", Label("vl", "single", "vlsingle"),
Name: nsn.Name,
},
Spec: vmv1.VLSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Paused: true,
+ },
},
RetentionPeriod: "1",
},
diff --git a/test/e2e/vmagent_test.go b/test/e2e/vmagent_test.go
index 4ee665f78a..49a9c2980a 100644
--- a/test/e2e/vmagent_test.go
+++ b/test/e2e/vmagent_test.go
@@ -53,8 +53,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8429/api/v1/write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -151,8 +153,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Name: nsn.Name,
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428"},
@@ -176,10 +180,12 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Name: nsn.Name,
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
- DisableAutomountServiceAccountToken: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ DisableAutomountServiceAccountToken: true,
+ },
},
StatefulMode: true,
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
@@ -204,8 +210,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Name: nsn.Name,
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428"},
@@ -241,8 +249,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Name: nsn.Name,
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428"},
@@ -323,10 +333,12 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Name: nsn.Name,
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseStrictSecurity: ptr.To(true),
- ReplicaCount: ptr.To[int32](1),
- DisableAutomountServiceAccountToken: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(true),
+ ReplicaCount: ptr.To[int32](1),
+ DisableAutomountServiceAccountToken: true,
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428"},
@@ -391,10 +403,12 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Name: nsn.Name,
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
@@ -410,10 +424,12 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Name: nsn.Name,
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
StatefulMode: true,
@@ -430,10 +446,12 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Name: nsn.Name,
},
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
DaemonSetMode: true,
@@ -443,6 +461,38 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
},
}, nil, func(cr *vmv1beta1.VMAgent) {},
),
+ Entry("with httpListeners", "http-listeners",
+ &vmv1beta1.VMAgent{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ Name: nsn.Name,
+ },
+ Spec: vmv1beta1.VMAgentSpec{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":8430", Primary: true},
+ {Name: "web2", Addr: ":8431"},
+ },
+ },
+ RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
+ {URL: "http://localhost:8428"},
+ },
+ },
+ }, nil, func(cr *vmv1beta1.VMAgent) {
+ var dep appsv1.Deployment
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cr.PrefixedName(), Namespace: namespace}, &dep)).ToNot(HaveOccurred())
+ checkContainerPort(dep.Spec.Template.Spec.Containers[0].Ports, "web", 8430)
+ checkContainerPort(dep.Spec.Template.Spec.Containers[0].Ports, "web2", 8431)
+
+ var svc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cr.PrefixedName(), Namespace: namespace}, &svc)).ToNot(HaveOccurred())
+ checkServicePort(svc.Spec.Ports, "web", 8430)
+ checkServicePort(svc.Spec.Ports, "web2", 8431)
+ },
+ ),
)
type testStep struct {
setup func(*vmv1beta1.VMAgent)
@@ -478,8 +528,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Entry("by scaling replicas to 2", "update-replicas-2",
&vmv1beta1.VMAgent{
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://some-vm-single:8428"},
@@ -503,9 +555,11 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Entry("by changing revisionHistoryLimit to 3", "update-revision",
&vmv1beta1.VMAgent{
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- RevisionHistoryLimitCount: ptr.To[int32](11),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ RevisionHistoryLimitCount: ptr.To[int32](11),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://some-vm-single:8428"},
@@ -532,8 +586,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Entry("by switching to statefulMode with shard", "stateful-shard",
&vmv1beta1.VMAgent{
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://some-vm-single:8428"},
@@ -565,8 +621,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
Entry("by transition into statefulMode and back", "stateful-transition",
&vmv1beta1.VMAgent{
Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://some-vm-single:8428"},
@@ -592,9 +650,11 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
),
Entry("by deleting and restoring PodDisruptionBudget and serviceScrape", "pdb-mutations-scrape",
&vmv1beta1.VMAgent{Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](2),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](2),
+ },
},
CommonScrapeParams: vmv1beta1.CommonScrapeParams{
SelectAllByDefault: true,
@@ -637,8 +697,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
),
Entry("by transition into daemonSet and back", "daemonset-transition",
&vmv1beta1.VMAgent{Spec: vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://some-vm-single:8428"},
@@ -686,8 +748,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428/api/v1/write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: &initialReplicas,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: &initialReplicas,
+ },
},
},
}
@@ -752,8 +816,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428/api/v1/write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -773,8 +839,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428/api/v1/write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -805,8 +873,10 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428/api/v1/write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -837,9 +907,11 @@ var _ = Describe("test vmagent Controller", Label("vm", "agent", "vmagent"), fun
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost:8428/api/v1/write"},
},
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Paused: true,
+ },
},
},
}
diff --git a/test/e2e/vmalert_test.go b/test/e2e/vmalert_test.go
index 734c7f3991..eac01d43a3 100644
--- a/test/e2e/vmalert_test.go
+++ b/test/e2e/vmalert_test.go
@@ -48,8 +48,10 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://some-datasource-url:8428",
@@ -106,12 +108,14 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Namespace: nsn.Namespace,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraEnvs: []corev1.EnvVar{
- {
- Name: "external_url",
- Value: "http://external-url.com",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraEnvs: []corev1.EnvVar{
+ {
+ Name: "external_url",
+ Value: "http://external-url.com",
+ },
},
},
},
@@ -141,9 +145,11 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Namespace: nsn.Namespace,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Secrets: []string{tlsSecretName},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Secrets: []string{tlsSecretName},
+ },
},
Notifiers: []vmv1beta1.VMAlertNotifierSpec{
{
@@ -280,10 +286,12 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Namespace: nsn.Namespace,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseStrictSecurity: ptr.To(true),
- ReplicaCount: ptr.To[int32](1),
- DisableAutomountServiceAccountToken: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(true),
+ ReplicaCount: ptr.To[int32](1),
+ DisableAutomountServiceAccountToken: true,
+ },
},
SelectAllByDefault: true,
Notifier: &vmv1beta1.VMAlertNotifierSpec{URL: "http://alert-manager-url:9093"},
@@ -330,14 +338,50 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Expect(hasVolume(dep.Spec.Template.Spec.Volumes, "kube-api-access")).To(HaveOccurred())
},
),
+ Entry("with httpListeners", "http-listeners",
+ &vmv1beta1.VMAlert{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: nsn.Namespace,
+ },
+ Spec: vmv1beta1.VMAlertSpec{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":8880", Primary: true},
+ {Name: "web2", Addr: ":8881"},
+ },
+ },
+ Notifier: &vmv1beta1.VMAlertNotifierSpec{URL: "http://alert-manager-url:9093"},
+ Datasource: vmv1beta1.VMAlertDatasourceSpec{
+ URL: "http://some-datasource-url:8428",
+ },
+ },
+ },
+ nil,
+ func(cr *vmv1beta1.VMAlert) {
+ var dep appsv1.Deployment
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cr.PrefixedName(), Namespace: namespace}, &dep)).ToNot(HaveOccurred())
+ checkContainerPort(dep.Spec.Template.Spec.Containers[0].Ports, "web", 8880)
+ checkContainerPort(dep.Spec.Template.Spec.Containers[0].Ports, "web2", 8881)
+
+ var svc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cr.PrefixedName(), Namespace: namespace}, &svc)).ToNot(HaveOccurred())
+ checkServicePort(svc.Spec.Ports, "web", 8880)
+ checkServicePort(svc.Spec.Ports, "web2", 8881)
+ },
+ ),
)
existObject := &vmv1beta1.VMAlert{
ObjectMeta: metav1.ObjectMeta{
Namespace: nsn.Namespace,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
@@ -414,8 +458,10 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: &initialReplicas,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: &initialReplicas,
+ },
},
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
@@ -483,8 +529,10 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
@@ -507,8 +555,10 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
@@ -542,8 +592,10 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
@@ -577,9 +629,11 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAlertSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Paused: true,
+ },
},
Datasource: vmv1beta1.VMAlertDatasourceSpec{
URL: "http://localhost:8428",
diff --git a/test/e2e/vmauth_test.go b/test/e2e/vmauth_test.go
index d745865b26..832ffe7c14 100644
--- a/test/e2e/vmauth_test.go
+++ b/test/e2e/vmauth_test.go
@@ -58,8 +58,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
},
Entry("with 1 replica", "replica-1", &vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
TargetRefs: []vmv1beta1.TargetRef{
@@ -91,8 +93,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
}),
Entry("with httproute", "httproute", &vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Port: "8427",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: "8427",
+ },
},
HTTPRoute: &vmv1beta1.EmbeddedHTTPRoute{
ParentRefs: []gwapiv1.ParentReference{
@@ -127,8 +131,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
}),
Entry("with httproute extrarules", "httproute-extrarules", &vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- Port: "8427",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ Port: "8427",
+ },
},
HTTPRoute: &vmv1beta1.EmbeddedHTTPRoute{
ParentRefs: []gwapiv1.ParentReference{
@@ -199,11 +205,13 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
}),
Entry("with strict security", "strict-security", &vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseStrictSecurity: ptr.To(true),
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
- DisableAutomountServiceAccountToken: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(true),
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ DisableAutomountServiceAccountToken: true,
+ },
},
UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
TargetRefs: []vmv1beta1.TargetRef{
@@ -250,6 +258,39 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
Expect(hasVolumeMount(ps.Containers[1].VolumeMounts, saTokenMount)).ToNot(HaveOccurred())
Expect(hasVolumeMount(ps.InitContainers[0].VolumeMounts, saTokenMount)).ToNot(HaveOccurred())
}),
+ Entry("with httpListeners", "http-listeners", &vmv1beta1.VMAuth{
+ Spec: vmv1beta1.VMAuthSpec{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":8440", Primary: true},
+ {Name: "web2", Addr: ":8441"},
+ },
+ },
+ UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
+ TargetRefs: []vmv1beta1.TargetRef{
+ {
+ Static: &vmv1beta1.StaticRef{
+ URLs: []string{"http://localhost:8490"},
+ },
+ Paths: []string{"/.*"},
+ },
+ },
+ },
+ },
+ }, func(cr *vmv1beta1.VMAuth) {
+ var dep appsv1.Deployment
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cr.PrefixedName(), Namespace: namespace}, &dep)).ToNot(HaveOccurred())
+ checkContainerPort(dep.Spec.Template.Spec.Containers[0].Ports, "web", 8440)
+ checkContainerPort(dep.Spec.Template.Spec.Containers[0].Ports, "web2", 8441)
+
+ var svc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Name: cr.PrefixedName(), Namespace: namespace}, &svc)).ToNot(HaveOccurred())
+ checkServicePort(svc.Spec.Ports, "web", 8440)
+ checkServicePort(svc.Spec.Ports, "web2", 8441)
+ }),
)
type testStep struct {
@@ -288,8 +329,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
Entry("by changing replicas to 2", "update-replicas-2",
&vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
TargetRefs: []vmv1beta1.TargetRef{
@@ -323,8 +366,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
&vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
TargetRefs: []vmv1beta1.TargetRef{
@@ -391,9 +436,11 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
&vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- UseDefaultResources: ptr.To(false),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ UseDefaultResources: ptr.To(false),
+ },
},
UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
TargetRefs: []vmv1beta1.TargetRef{
@@ -449,9 +496,11 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
&vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](2),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](2),
+ },
},
PodDisruptionBudget: &vmv1beta1.EmbeddedPodDisruptionBudgetSpec{
MaxUnavailable: &intstr.IntOrString{IntVal: 1},
@@ -539,8 +588,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
&vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
TargetRefs: []vmv1beta1.TargetRef{
@@ -626,8 +677,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
&vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
TargetRefs: []vmv1beta1.TargetRef{
@@ -698,8 +751,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
&vmv1beta1.VMAuth{
Spec: vmv1beta1.VMAuthSpec{
SelectAllByDefault: true,
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
UnauthorizedUserAccessSpec: &vmv1beta1.VMAuthUnauthorizedUserAccessSpec{
TargetRefs: []vmv1beta1.TargetRef{
@@ -734,8 +789,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: &initialReplicas,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: &initialReplicas,
+ },
},
},
}
@@ -796,8 +853,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -814,8 +873,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -843,8 +904,10 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -872,9 +935,11 @@ var _ = Describe("test vmauth Controller", Label("vm", "auth"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Paused: true,
+ },
},
},
}
diff --git a/test/e2e/vmcluster_test.go b/test/e2e/vmcluster_test.go
index 148142416d..5e6e0e9129 100644
--- a/test/e2e/vmcluster_test.go
+++ b/test/e2e/vmcluster_test.go
@@ -59,18 +59,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -147,18 +153,25 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
- VMInsert: &vmv1beta1.VMInsert{CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- },
+ VMInsert: &vmv1beta1.VMInsert{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
},
},
@@ -172,13 +185,17 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -192,13 +209,17 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -213,24 +234,30 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseStrictSecurity: ptr.To(true),
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(true),
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseStrictSecurity: ptr.To(true),
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(true),
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseStrictSecurity: ptr.To(true),
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(true),
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -264,49 +291,55 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
- SecurityContext: &vmv1beta1.SecurityContext{
- PodSecurityContext: &corev1.PodSecurityContext{
- RunAsNonRoot: ptr.To(true),
- RunAsUser: ptr.To(int64(65534)),
- RunAsGroup: ptr.To(int64(65534)),
- },
- ContainerSecurityContext: &vmv1beta1.ContainerSecurityContext{
- Privileged: ptr.To(false),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ SecurityContext: &vmv1beta1.SecurityContext{
+ PodSecurityContext: &corev1.PodSecurityContext{
+ RunAsNonRoot: ptr.To(true),
+ RunAsUser: ptr.To(int64(65534)),
+ RunAsGroup: ptr.To(int64(65534)),
+ },
+ ContainerSecurityContext: &vmv1beta1.ContainerSecurityContext{
+ Privileged: ptr.To(false),
+ },
},
},
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
- SecurityContext: &vmv1beta1.SecurityContext{
- PodSecurityContext: &corev1.PodSecurityContext{
- RunAsNonRoot: ptr.To(true),
- RunAsUser: ptr.To(int64(65534)),
- RunAsGroup: ptr.To(int64(65534)),
- },
- ContainerSecurityContext: &vmv1beta1.ContainerSecurityContext{
- Privileged: ptr.To(false),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ SecurityContext: &vmv1beta1.SecurityContext{
+ PodSecurityContext: &corev1.PodSecurityContext{
+ RunAsNonRoot: ptr.To(true),
+ RunAsUser: ptr.To(int64(65534)),
+ RunAsGroup: ptr.To(int64(65534)),
+ },
+ ContainerSecurityContext: &vmv1beta1.ContainerSecurityContext{
+ Privileged: ptr.To(false),
+ },
},
},
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
- SecurityContext: &vmv1beta1.SecurityContext{
- PodSecurityContext: &corev1.PodSecurityContext{
- RunAsNonRoot: ptr.To(true),
- RunAsUser: ptr.To(int64(65534)),
- RunAsGroup: ptr.To(int64(65534)),
- },
- ContainerSecurityContext: &vmv1beta1.ContainerSecurityContext{
- Privileged: ptr.To(false),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ SecurityContext: &vmv1beta1.SecurityContext{
+ PodSecurityContext: &corev1.PodSecurityContext{
+ RunAsNonRoot: ptr.To(true),
+ RunAsUser: ptr.To(int64(65534)),
+ RunAsGroup: ptr.To(int64(65534)),
+ },
+ ContainerSecurityContext: &vmv1beta1.ContainerSecurityContext{
+ Privileged: ptr.To(false),
+ },
},
},
},
@@ -342,26 +375,32 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
@@ -381,18 +420,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Enabled: true,
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -407,6 +452,72 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedInternalName(vmv1beta1.ClusterComponentSelect)}, &svc)).ToNot(HaveOccurred())
},
),
+ Entry("with httpListeners on all components", "http-listeners",
+ &vmv1beta1.VMCluster{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ Name: nsn.Name,
+ },
+ Spec: vmv1beta1.VMClusterSpec{
+ RetentionPeriod: "1",
+ VMStorage: &vmv1beta1.VMStorage{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":8482", Primary: true},
+ },
+ },
+ },
+ VMSelect: &vmv1beta1.VMSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":8481", Primary: true},
+ },
+ },
+ },
+ VMInsert: &vmv1beta1.VMInsert{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":8480", Primary: true},
+ {Name: "web2", Addr: ":8483"},
+ },
+ },
+ },
+ },
+ },
+ func(cr *vmv1beta1.VMCluster) {
+ var insertDep appsv1.Deployment
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentInsert)}, &insertDep)).ToNot(HaveOccurred())
+ checkContainerPort(insertDep.Spec.Template.Spec.Containers[0].Ports, "web", 8480)
+ checkContainerPort(insertDep.Spec.Template.Spec.Containers[0].Ports, "web2", 8483)
+ var insertSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentInsert)}, &insertSvc)).ToNot(HaveOccurred())
+ checkServicePort(insertSvc.Spec.Ports, "web", 8480)
+ checkServicePort(insertSvc.Spec.Ports, "web2", 8483)
+
+ var selectSts appsv1.StatefulSet
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentSelect)}, &selectSts)).ToNot(HaveOccurred())
+ checkContainerPort(selectSts.Spec.Template.Spec.Containers[0].Ports, "web", 8481)
+ var selectSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentSelect)}, &selectSvc)).ToNot(HaveOccurred())
+ checkServicePort(selectSvc.Spec.Ports, "web", 8481)
+
+ var storageSts appsv1.StatefulSet
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentStorage)}, &storageSts)).ToNot(HaveOccurred())
+ checkContainerPort(storageSts.Spec.Template.Spec.Containers[0].Ports, "web", 8482)
+ var storageSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentStorage)}, &storageSvc)).ToNot(HaveOccurred())
+ checkServicePort(storageSvc.Spec.Ports, "web", 8482)
+ },
+ ),
)
})
Context("update", func() {
@@ -433,18 +544,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(initialReplicas),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(initialReplicas),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(initialReplicas),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(initialReplicas),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(initialReplicas),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(initialReplicas),
+ },
},
},
},
@@ -560,18 +677,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -602,18 +725,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -675,18 +804,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -719,18 +854,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -751,18 +892,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -794,18 +941,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -832,9 +985,11 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
testStep{
modify: func(cr *vmv1beta1.VMCluster) {
cr.Spec.VMSelect = &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ },
},
}
},
@@ -850,18 +1005,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -898,15 +1059,19 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
testStep{
modify: func(cr *vmv1beta1.VMCluster) {
cr.Spec.VMStorage = &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ },
},
}
cr.Spec.VMInsert = &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- UseDefaultResources: ptr.To(false),
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseDefaultResources: ptr.To(false),
+ ReplicaCount: ptr.To[int32](1),
+ },
},
}
},
@@ -925,8 +1090,10 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
ServiceSpec: &vmv1beta1.AdditionalServiceSpec{
EmbeddedObjectMetadata: vmv1beta1.EmbeddedObjectMetadata{
@@ -945,8 +1112,10 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
ServiceSpec: &vmv1beta1.AdditionalServiceSpec{
Spec: corev1.ServiceSpec{
@@ -1023,18 +1192,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
RetentionPeriod: "1",
ImagePullSecrets: nil,
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1074,18 +1249,24 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() {
Enabled: false,
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1188,18 +1369,24 @@ up{baz="bar"} 123
Enabled: false,
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1324,18 +1511,24 @@ up{baz="bar"} 123
},
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](2),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](2),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1433,8 +1626,10 @@ up{baz="bar"} 123
RequestsLoadBalancer: vmv1beta1.VMAuthLoadBalancer{Enabled: true},
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
Storage: &vmv1beta1.StorageSpec{
VolumeClaimTemplate: vmv1beta1.EmbeddedPersistentVolumeClaim{
@@ -1454,13 +1649,17 @@ up{baz="bar"} 123
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1487,18 +1686,24 @@ up{baz="bar"} 123
RequestsLoadBalancer: vmv1beta1.VMAuthLoadBalancer{Enabled: true},
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1615,8 +1820,10 @@ up{baz="bar"} 123
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](4),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](4),
+ },
},
PodMetadata: &vmv1beta1.EmbeddedObjectMetadata{
Labels: map[string]string{"version": "old"},
@@ -1626,13 +1833,17 @@ up{baz="bar"} 123
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1671,8 +1882,10 @@ up{baz="bar"} 123
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](4),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](4),
+ },
},
PodMetadata: &vmv1beta1.EmbeddedObjectMetadata{
Labels: map[string]string{"version": "old"},
@@ -1682,13 +1895,17 @@ up{baz="bar"} 123
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1731,8 +1948,10 @@ up{baz="bar"} 123
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](4),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](4),
+ },
},
PodMetadata: &vmv1beta1.EmbeddedObjectMetadata{
Labels: map[string]string{"version": "old"},
@@ -1745,13 +1964,17 @@ up{baz="bar"} 123
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1827,13 +2050,25 @@ up{baz="bar"} 123
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
},
}
@@ -1852,18 +2087,24 @@ up{baz="bar"} 123
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -1894,13 +2135,25 @@ up{baz="bar"} 123
Spec: vmv1beta1.VMClusterSpec{
RetentionPeriod: "1",
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
},
}
@@ -1931,13 +2184,25 @@ up{baz="bar"} 123
RetentionPeriod: "1",
Paused: true,
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
},
},
}
diff --git a/test/e2e/vmdistributed_test.go b/test/e2e/vmdistributed_test.go
index e3e159f323..d969199b6f 100644
--- a/test/e2e/vmdistributed_test.go
+++ b/test/e2e/vmdistributed_test.go
@@ -31,13 +31,19 @@ func genVMClusterSpec(opts ...func(*vmv1beta1.VMClusterSpec)) vmv1beta1.VMCluste
s := vmv1beta1.VMClusterSpec{
VMSelect: &vmv1beta1.VMSelect{
- CommonAppsParams: commonAppsParams,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: commonAppsParams,
+ },
},
VMInsert: &vmv1beta1.VMInsert{
- CommonAppsParams: noReplicas,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: noReplicas,
+ },
},
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: commonAppsParams,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: commonAppsParams,
+ },
},
}
for _, opt := range opts {
@@ -65,8 +71,10 @@ func createVMClusters(ctx context.Context, wg *sync.WaitGroup, k8sClient client.
func genVMAgentSpec() vmv1beta1.VMAgentSpec {
return vmv1beta1.VMAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{
{URL: "http://localhost"},
@@ -154,8 +162,10 @@ var _ = Describe("e2e VMDistributed", Label("vm", "vmdistributed"), func() {
UpdatePause: &metav1.Duration{Duration: 1 * time.Second},
VMAgent: vmv1alpha1.VMDistributedZoneAgent{
Spec: vmv1alpha1.VMDistributedZoneAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](2),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](2),
+ },
},
},
},
@@ -331,8 +341,10 @@ var _ = Describe("e2e VMDistributed", Label("vm", "vmdistributed"), func() {
VMAuth: vmv1alpha1.VMDistributedAuth{
Name: nsn.Name,
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -683,8 +695,10 @@ var _ = Describe("e2e VMDistributed", Label("vm", "vmdistributed"), func() {
VMInsert: cr.Spec.Zones[0].VMCluster.Spec.VMInsert,
VMSelect: cr.Spec.Zones[0].VMCluster.Spec.VMSelect,
VMStorage: &vmv1beta1.VMStorage{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](initialReplicas + 1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](initialReplicas + 1),
+ },
},
},
}
@@ -891,9 +905,25 @@ var _ = Describe("e2e VMDistributed", Label("vm", "vmdistributed"), func() {
zonesCount := 2
clusterSpec := vmv1beta1.VMClusterSpec{
- VMSelect: &vmv1beta1.VMSelect{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)}},
- VMInsert: &vmv1beta1.VMInsert{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)}},
- VMStorage: &vmv1beta1.VMStorage{CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)}},
+ VMSelect: &vmv1beta1.VMSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
+ },
+ VMInsert: &vmv1beta1.VMInsert{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{ReplicaCount: ptr.To[int32](1)},
+ },
+ },
+ VMStorage: &vmv1beta1.VMStorage{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ },
+ },
}
zs := make([]vmv1alpha1.VMDistributedZone, zonesCount)
@@ -1071,8 +1101,10 @@ var _ = Describe("e2e VMDistributed", Label("vm", "vmdistributed"), func() {
VMAuth: vmv1alpha1.VMDistributedAuth{
Name: nsn.Name,
Spec: vmv1beta1.VMAuthSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
diff --git a/test/e2e/vmsingle_test.go b/test/e2e/vmsingle_test.go
index a0ed98adba..03452ac47d 100644
--- a/test/e2e/vmsingle_test.go
+++ b/test/e2e/vmsingle_test.go
@@ -53,8 +53,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -116,8 +118,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Namespace: namespace,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
RemovePvcAfterDelete: true,
@@ -154,12 +158,14 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Namespace: namespace,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Volumes: []corev1.Volume{
- {Name: "backup", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Volumes: []corev1.Volume{
+ {Name: "backup", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}},
+ },
+ UseDefaultResources: ptr.To(false),
},
- UseDefaultResources: ptr.To(false),
},
VMBackup: &vmv1beta1.VMBackup{
Destination: "fs:///opt/backup-dir",
@@ -201,9 +207,11 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Namespace: namespace,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- UseStrictSecurity: ptr.To(true),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ UseStrictSecurity: ptr.To(true),
+ },
},
RetentionPeriod: "1",
RemovePvcAfterDelete: true,
@@ -232,9 +240,11 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Namespace: namespace,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- UseStrictSecurity: ptr.To(false),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ UseStrictSecurity: ptr.To(false),
+ },
},
RetentionPeriod: "1",
RemovePvcAfterDelete: true,
@@ -263,9 +273,11 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Namespace: namespace,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- UseStrictSecurity: ptr.To(false),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ UseStrictSecurity: ptr.To(false),
+ },
},
RetentionPeriod: "1",
RemovePvcAfterDelete: true,
@@ -287,35 +299,37 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Namespace: namespace,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Volumes: []corev1.Volume{
- {
- Name: "data",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Volumes: []corev1.Volume{
+ {
+ Name: "data",
+ VolumeSource: corev1.VolumeSource{
+ EmptyDir: &corev1.EmptyDirVolumeSource{},
+ },
},
- },
- {
- Name: "backup",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
+ {
+ Name: "backup",
+ VolumeSource: corev1.VolumeSource{
+ EmptyDir: &corev1.EmptyDirVolumeSource{},
+ },
},
- },
- {
- Name: "unused",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
+ {
+ Name: "unused",
+ VolumeSource: corev1.VolumeSource{
+ EmptyDir: &corev1.EmptyDirVolumeSource{},
+ },
},
},
- },
- VolumeMounts: []corev1.VolumeMount{
- {
- Name: "unused",
- MountPath: "/opt/unused/mountpoint",
+ VolumeMounts: []corev1.VolumeMount{
+ {
+ Name: "unused",
+ MountPath: "/opt/unused/mountpoint",
+ },
},
+ UseStrictSecurity: ptr.To(false),
},
- UseStrictSecurity: ptr.To(false),
},
RetentionPeriod: "1",
RemovePvcAfterDelete: true,
@@ -343,6 +357,35 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Expect(ts.Containers[1].VolumeMounts[2].Name).To(Equal("backup"))
Expect(ts.Containers[1].VolumeMounts[3].Name).To(Equal("license"))
}),
+ Entry("with httpListeners", "http-listeners", false,
+ &vmv1beta1.VMSingle{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ },
+ Spec: vmv1beta1.VMSingleSpec{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(false),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":8420", Primary: true},
+ {Name: "web2", Addr: ":8421"},
+ },
+ },
+ },
+ },
+ func(cr *vmv1beta1.VMSingle) {
+ createdChildObjects := types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName()}
+ var createdDeploy appsv1.Deployment
+ Expect(k8sClient.Get(ctx, createdChildObjects, &createdDeploy)).ToNot(HaveOccurred())
+ checkContainerPort(createdDeploy.Spec.Template.Spec.Containers[0].Ports, "web", 8420)
+ checkContainerPort(createdDeploy.Spec.Template.Spec.Containers[0].Ports, "web2", 8421)
+
+ var svc corev1.Service
+ Expect(k8sClient.Get(ctx, createdChildObjects, &svc)).ToNot(HaveOccurred())
+ checkServicePort(svc.Spec.Ports, "web", 8420)
+ checkServicePort(svc.Spec.Ports, "web2", 8421)
+ }),
)
baseSingle := &vmv1beta1.VMSingle{
@@ -352,8 +395,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Spec: vmv1beta1.VMSingleSpec{
RemovePvcAfterDelete: true,
RetentionPeriod: "10",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -487,8 +532,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: &initialReplicas,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: &initialReplicas,
+ },
},
RetentionPeriod: "1",
},
@@ -550,8 +597,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -569,8 +618,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -599,8 +650,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -629,9 +682,11 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Paused: true,
+ },
},
RetentionPeriod: "1",
},
@@ -660,8 +715,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -697,8 +754,10 @@ var _ = Describe("test vmsingle Controller", Label("vm", "single"), func() {
Name: nsn.Name,
},
Spec: vmv1beta1.VMSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
diff --git a/test/e2e/vtagent_test.go b/test/e2e/vtagent_test.go
index 3109e6da96..4ec185fd24 100644
--- a/test/e2e/vtagent_test.go
+++ b/test/e2e/vtagent_test.go
@@ -62,8 +62,10 @@ var _ = Describe("test vtagent Controller", Label("vt", "agent", "vtagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{URL: "http://localhost:10428/insert/native"},
@@ -100,8 +102,10 @@ var _ = Describe("test vtagent Controller", Label("vt", "agent", "vtagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
Storage: &vmv1beta1.StorageSpec{
VolumeClaimTemplate: vmv1beta1.EmbeddedPersistentVolumeClaim{
@@ -190,8 +194,10 @@ var _ = Describe("test vtagent Controller", Label("vt", "agent", "vtagent"), fun
Name: nsn.Name,
},
Spec: vmv1.VTAgentSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
{
@@ -294,6 +300,36 @@ var _ = Describe("test vtagent Controller", Label("vt", "agent", "vtagent"), fun
))
Expect(cnt.Args).To(ContainElements("-remoteWrite.bearerTokenFile=/etc/vt/remote-write-assets/bearer-vtagent/token,"))
}),
+ Entry("with httpListeners", "http-listeners", &vmv1.VTAgent{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ Name: nsn.Name,
+ },
+ Spec: vmv1.VTAgentSpec{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":10440", Primary: true},
+ {Name: "web2", Addr: ":10441"},
+ },
+ },
+ RemoteWrite: []vmv1.VTAgentRemoteWriteSpec{
+ {URL: "http://localhost:10428/insert/native"},
+ },
+ },
+ }, nil, func(cr *vmv1.VTAgent) {
+ var sts appsv1.StatefulSet
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName()}, &sts)).ToNot(HaveOccurred())
+ checkContainerPort(sts.Spec.Template.Spec.Containers[0].Ports, "web", 10440)
+ checkContainerPort(sts.Spec.Template.Spec.Containers[0].Ports, "web2", 10441)
+
+ var svc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName()}, &svc)).ToNot(HaveOccurred())
+ checkServicePort(svc.Spec.Ports, "web", 10440)
+ checkServicePort(svc.Spec.Ports, "web2", 10441)
+ }),
)
})
})
diff --git a/test/e2e/vtcluster_test.go b/test/e2e/vtcluster_test.go
index 701c517b0b..ded281bdcf 100644
--- a/test/e2e/vtcluster_test.go
+++ b/test/e2e/vtcluster_test.go
@@ -60,26 +60,32 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
Spec: vmv1.VTClusterSpec{
Storage: &vmv1.VTStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
},
@@ -87,6 +93,72 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
},
func(cr *vmv1.VTCluster) {},
),
+ Entry("with httpListeners on all components", "http-listeners",
+ &vmv1.VTCluster{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ Name: nsn.Name,
+ },
+ Spec: vmv1.VTClusterSpec{
+ Storage: &vmv1.VTStorage{
+ RetentionPeriod: "1",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":10491", Primary: true},
+ },
+ },
+ },
+ Select: &vmv1.VTSelect{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":10471", Primary: true},
+ },
+ },
+ },
+ Insert: &vmv1.VTInsert{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":10481", Primary: true},
+ {Name: "web2", Addr: ":10482"},
+ },
+ },
+ },
+ },
+ },
+ func(cr *vmv1.VTCluster) {
+ var insertDep appsv1.Deployment
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentInsert)}, &insertDep)).ToNot(HaveOccurred())
+ checkContainerPort(insertDep.Spec.Template.Spec.Containers[0].Ports, "web", 10481)
+ checkContainerPort(insertDep.Spec.Template.Spec.Containers[0].Ports, "web2", 10482)
+ var insertSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentInsert)}, &insertSvc)).ToNot(HaveOccurred())
+ checkServicePort(insertSvc.Spec.Ports, "web", 10481)
+ checkServicePort(insertSvc.Spec.Ports, "web2", 10482)
+
+ var selectDep appsv1.Deployment
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentSelect)}, &selectDep)).ToNot(HaveOccurred())
+ checkContainerPort(selectDep.Spec.Template.Spec.Containers[0].Ports, "web", 10471)
+ var selectSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentSelect)}, &selectSvc)).ToNot(HaveOccurred())
+ checkServicePort(selectSvc.Spec.Ports, "web", 10471)
+
+ var storageSts appsv1.StatefulSet
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentStorage)}, &storageSts)).ToNot(HaveOccurred())
+ checkContainerPort(storageSts.Spec.Template.Spec.Containers[0].Ports, "web", 10491)
+ var storageSvc corev1.Service
+ Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName(vmv1beta1.ClusterComponentStorage)}, &storageSvc)).ToNot(HaveOccurred())
+ checkServicePort(storageSvc.Spec.Ports, "web", 10491)
+ },
+ ),
)
baseVTCluster := &vmv1.VTCluster{
@@ -98,8 +170,10 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
Select: &vmv1.VTSelect{},
Storage: &vmv1.VTStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -282,8 +356,10 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
modify: func(cr *vmv1.VTCluster) {
By("upscaling vtselect, removing vtinsert", func() {
cr.Spec.Select = &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(2)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(2)),
+ },
},
}
cr.Spec.Insert = nil
@@ -308,13 +384,17 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
modify: func(cr *vmv1.VTCluster) {
By("downscaling all components to 0 replicas", func() {
cr.Spec.Select = &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
}
cr.Spec.Insert = &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To(int32(0)),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To(int32(0)),
+ },
},
}
cr.Spec.Storage.ReplicaCount = ptr.To(int32(0))
@@ -353,8 +433,10 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
Select: &vmv1.VTSelect{},
Storage: &vmv1.VTStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -373,19 +455,25 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
},
Spec: vmv1.VTClusterSpec{
Insert: &vmv1.VTInsert{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
Select: &vmv1.VTSelect{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
Storage: &vmv1.VTStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -418,8 +506,10 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
Select: &vmv1.VTSelect{},
Storage: &vmv1.VTStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
@@ -453,8 +543,10 @@ var _ = Describe("test vtcluster Controller", Label("vt", "cluster", "vtcluster"
Select: &vmv1.VTSelect{},
Storage: &vmv1.VTStorage{
RetentionPeriod: "1",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
},
diff --git a/test/e2e/vtsingle_test.go b/test/e2e/vtsingle_test.go
index 3f0678a514..89a258dfbe 100644
--- a/test/e2e/vtsingle_test.go
+++ b/test/e2e/vtsingle_test.go
@@ -59,9 +59,11 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
Namespace: namespace,
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- UseStrictSecurity: ptr.To(true),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ UseStrictSecurity: ptr.To(true),
+ },
},
RetentionPeriod: "1",
Storage: &corev1.PersistentVolumeClaimSpec{
@@ -89,9 +91,11 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
Namespace: namespace,
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- UseStrictSecurity: ptr.To(false),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ UseStrictSecurity: ptr.To(false),
+ },
},
RetentionPeriod: "1",
},
@@ -111,29 +115,31 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
Namespace: namespace,
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Volumes: []corev1.Volume{
- {
- Name: "data",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Volumes: []corev1.Volume{
+ {
+ Name: "data",
+ VolumeSource: corev1.VolumeSource{
+ EmptyDir: &corev1.EmptyDirVolumeSource{},
+ },
},
- },
- {
- Name: "unused",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
+ {
+ Name: "unused",
+ VolumeSource: corev1.VolumeSource{
+ EmptyDir: &corev1.EmptyDirVolumeSource{},
+ },
},
},
- },
- VolumeMounts: []corev1.VolumeMount{
- {
- Name: "unused",
- MountPath: "/opt/unused/mountpoint",
+ VolumeMounts: []corev1.VolumeMount{
+ {
+ Name: "unused",
+ MountPath: "/opt/unused/mountpoint",
+ },
},
+ UseStrictSecurity: ptr.To(false),
},
- UseStrictSecurity: ptr.To(false),
},
RetentionPeriod: "1",
StorageDataPath: "/custom-path/internal/dir",
@@ -157,10 +163,12 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
Namespace: namespace,
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- ExtraArgs: map[string]string{
- "httpListenAddr.useProxyProtocol": "true",
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ ExtraArgs: map[string]string{
+ "httpListenAddr.useProxyProtocol": "true",
+ },
},
},
RetentionPeriod: "1",
@@ -168,6 +176,36 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
},
func(cr *vmv1.VTSingle) {},
),
+ Entry("with httpListeners", "http-listeners",
+ &vmv1.VTSingle{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: namespace,
+ },
+ Spec: vmv1.VTSingleSpec{
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ UseStrictSecurity: ptr.To(false),
+ },
+ HTTPListeners: []vmv1beta1.HTTPListener{
+ {Name: "web", Addr: ":10420", Primary: true},
+ {Name: "web2", Addr: ":10422"},
+ },
+ },
+ RetentionPeriod: "1",
+ },
+ },
+ func(cr *vmv1.VTSingle) {
+ createdChildObjects := types.NamespacedName{Namespace: namespace, Name: cr.PrefixedName()}
+ var createdDeploy appsv1.Deployment
+ Expect(k8sClient.Get(ctx, createdChildObjects, &createdDeploy)).ToNot(HaveOccurred())
+ checkContainerPort(createdDeploy.Spec.Template.Spec.Containers[0].Ports, "web", 10420)
+ checkContainerPort(createdDeploy.Spec.Template.Spec.Containers[0].Ports, "web2", 10422)
+
+ var svc corev1.Service
+ Expect(k8sClient.Get(ctx, createdChildObjects, &svc)).ToNot(HaveOccurred())
+ checkServicePort(svc.Spec.Ports, "web", 10420)
+ checkServicePort(svc.Spec.Ports, "web2", 10422)
+ }),
)
baseVTSingle := &vmv1.VTSingle{
@@ -176,8 +214,10 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
},
Spec: vmv1.VTSingleSpec{
RetentionPeriod: "10",
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
},
}
@@ -264,8 +304,10 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
Name: nsn.Name,
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -283,8 +325,10 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
Name: nsn.Name,
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -313,8 +357,10 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
Name: nsn.Name,
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ },
},
RetentionPeriod: "1",
},
@@ -343,9 +389,11 @@ var _ = Describe("test vtsingle Controller", Label("vt", "single", "vtsingle"),
Name: nsn.Name,
},
Spec: vmv1.VTSingleSpec{
- CommonAppsParams: vmv1beta1.CommonAppsParams{
- ReplicaCount: ptr.To[int32](1),
- Paused: true,
+ StandardAppsParams: vmv1beta1.StandardAppsParams{
+ CommonAppsParams: vmv1beta1.CommonAppsParams{
+ ReplicaCount: ptr.To[int32](1),
+ Paused: true,
+ },
},
RetentionPeriod: "1",
},