Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions api/operator/v1/vlagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,8 @@ type VLAgentSpec struct {

// ServiceAccountName is the name of the ServiceAccount to use to run the pods
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty"`

*vmv1beta1.EmbeddedProbes `json:",inline"`
vmv1beta1.CommonDefaultableParams `json:",inline,omitempty"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
vmv1beta1.CommonAppsParams `json:",inline,omitempty"`
}

type VLAgentK8sCollector struct {
Expand Down Expand Up @@ -181,6 +178,11 @@ func (cr *VLAgent) Validate() error {
return nil
}

// UseProxyProtocol implements build.probeCRD interface
func (cr *VLAgent) UseProxyProtocol() bool {
return vmv1beta1.UseProxyProtocol(cr.Spec.ExtraArgs)
}

// UnmarshalJSON implements json.Unmarshaler interface
func (cr *VLAgentSpec) UnmarshalJSON(src []byte) error {
type pcr VLAgentSpec
Expand Down Expand Up @@ -444,11 +446,6 @@ func (cr *VLAgent) AsURL() string {
return fmt.Sprintf("%s://%s.%s.svc:%s", vmv1beta1.HTTPProtoFromFlags(cr.Spec.ExtraArgs), cr.PrefixedName(), cr.Namespace, port)
}

// Probe implements build.probeCRD interface
func (cr *VLAgent) Probe() *vmv1beta1.EmbeddedProbes {
return cr.Spec.EmbeddedProbes
}

// ProbePath implements build.probeCRD interface
func (cr *VLAgent) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
Expand Down
48 changes: 21 additions & 27 deletions api/operator/v1/vlcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ type VLInsert struct {
ServiceScrapeSpec *vmv1beta1.VMServiceScrapeSpec `json:"serviceScrapeSpec,omitempty"`
// PodDisruptionBudget created by operator
// +optional
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
*vmv1beta1.EmbeddedProbes `json:",inline"`
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
// Configures horizontal pod autoscaling.
// +optional
HPA *vmv1beta1.EmbeddedHPA `json:"hpa,omitempty"`
Expand All @@ -259,20 +258,19 @@ type VLInsert struct {
// +optional
RollingUpdate *appsv1.RollingUpdateDeployment `json:"rollingUpdate,omitempty"`

vmv1beta1.CommonDefaultableParams `json:",inline"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline"`
}

// Probe implements build.probeCRD interface
func (cr *VLInsert) Probe() *vmv1beta1.EmbeddedProbes {
return cr.EmbeddedProbes
vmv1beta1.CommonAppsParams `json:",inline"`
}

// ProbePath implements build.probeCRD interface
func (cr *VLInsert) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
}

// 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))
Expand Down Expand Up @@ -424,8 +422,7 @@ type VLSelect struct {
ServiceScrapeSpec *vmv1beta1.VMServiceScrapeSpec `json:"serviceScrapeSpec,omitempty"`
// PodDisruptionBudget created by operator
// +optional
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
*vmv1beta1.EmbeddedProbes `json:",inline"`
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
// Configures horizontal pod autoscaling.
// +optional
HPA *vmv1beta1.EmbeddedHPA `json:"hpa,omitempty"`
Expand All @@ -444,8 +441,7 @@ type VLSelect struct {
// ExtraStorageNodes - defines additional storage nodes to VLSelect
ExtraStorageNodes []VLStorageNode `json:"extraStorageNodes,omitempty"`

vmv1beta1.CommonDefaultableParams `json:",inline"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline"`
vmv1beta1.CommonAppsParams `json:",inline"`
}

// GetMetricsPath returns prefixed path for metric requests
Expand All @@ -456,6 +452,11 @@ func (cr *VLSelect) GetMetricsPath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, metricsPath)
}

// UseProxyProtocol implements build.probeCRD interface
func (cr *VLSelect) UseProxyProtocol() bool {
return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
}

// ExtraArgs returns additionally configured command-line arguments
func (cr *VLSelect) GetExtraArgs() map[string]string {
return cr.ExtraArgs
Expand All @@ -471,11 +472,6 @@ func (cr *VLSelect) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
}

// Probe implements build.probeCRD interface
func (cr *VLSelect) Probe() *vmv1beta1.EmbeddedProbes {
return cr.EmbeddedProbes
}

// ProbePath implements build.probeCRD interface
func (cr *VLSelect) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
Expand Down Expand Up @@ -540,8 +536,7 @@ type VLStorage struct {
ServiceScrapeSpec *vmv1beta1.VMServiceScrapeSpec `json:"serviceScrapeSpec,omitempty"`
// PodDisruptionBudget created by operator
// +optional
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
*vmv1beta1.EmbeddedProbes `json:",inline"`
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
// RollingUpdateStrategy defines strategy for application updates
// Default is OnDelete, in this case operator handles update process
// Can be changed for RollingUpdate
Expand Down Expand Up @@ -577,8 +572,7 @@ type VLStorage struct {
// +optional
MaintenanceSelectNodeIDs []int32 `json:"maintenanceSelectNodeIDs,omitempty"`

vmv1beta1.CommonDefaultableParams `json:",inline"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline"`
vmv1beta1.CommonAppsParams `json:",inline"`

// RollingUpdateStrategyBehavior defines customized behavior for rolling updates.
// It applies if the RollingUpdateStrategy is set to OnDelete, which is the default.
Expand All @@ -594,6 +588,11 @@ func (cr *VLStorage) GetStorageVolumeName() string {
return "vlstorage-db"
}

// UseProxyProtocol implements build.probeCRD interface
func (cr *VLStorage) UseProxyProtocol() bool {
return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
}

// GetMetricsPath returns prefixed path for metric requests
func (cr *VLStorage) GetMetricsPath() string {
if cr == nil {
Expand All @@ -617,11 +616,6 @@ func (cr *VLStorage) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
}

// Probe implements build.probeCRD interface
func (cr *VLStorage) Probe() *vmv1beta1.EmbeddedProbes {
return cr.EmbeddedProbes
}

// ProbePath implements build.probeCRD interface
func (cr *VLStorage) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
Expand Down
14 changes: 6 additions & 8 deletions api/operator/v1/vlsingle_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ type VLSingleSpec struct {
// created by operator for the given CustomResource
ManagedMetadata *vmv1beta1.ManagedObjectsMetadata `json:"managedMetadata,omitempty"`

vmv1beta1.CommonDefaultableParams `json:",inline,omitempty"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline,omitempty"`
vmv1beta1.CommonAppsParams `json:",inline,omitempty"`

// LogLevel for VictoriaLogs to be configured with.
// +optional
Expand Down Expand Up @@ -96,8 +95,6 @@ type VLSingleSpec struct {
// ServiceScrapeSpec that will be added to vlsingle VMServiceScrape spec
// +optional
ServiceScrapeSpec *vmv1beta1.VMServiceScrapeSpec `json:"serviceScrapeSpec,omitempty"`
// LivenessProbe that will be added to VLSingle pod
*vmv1beta1.EmbeddedProbes `json:",inline"`

// ServiceAccountName is the name of the ServiceAccount to use to run the pods
// +optional
Expand Down Expand Up @@ -148,6 +145,11 @@ func (cr *VLSingle) GetStatus() *VLSingleStatus {
return &cr.Status
}

// UseProxyProtocol implements build.probeCRD interface
func (cr *VLSingle) UseProxyProtocol() bool {
return vmv1beta1.UseProxyProtocol(cr.Spec.ExtraArgs)
}

// DefaultStatusFields implements reconcile.ObjectWithDeepCopyAndStatus interface
func (cr *VLSingle) DefaultStatusFields(vs *VLSingleStatus) {
}
Expand Down Expand Up @@ -193,10 +195,6 @@ func (cr *VLSingleSpec) UnmarshalJSON(src []byte) error {
return nil
}

func (cr *VLSingle) Probe() *vmv1beta1.EmbeddedProbes {
return cr.Spec.EmbeddedProbes
}

func (cr *VLSingle) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.Spec.ExtraArgs, healthPath)
}
Expand Down
18 changes: 8 additions & 10 deletions api/operator/v1/vmanomaly_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ type VMAnomalySpec struct {
ShardCount *int `json:"shardCount,omitempty"`
// PodDisruptionBudget created by operator
// +optional
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
*vmv1beta1.EmbeddedProbes `json:",inline"`
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
// ConfigRawYaml - raw configuration for anomaly,
// it helps it to start without secret.
// priority -> hardcoded ConfigRaw -> ConfigRaw, provided by user -> ConfigSecret.
Expand Down Expand Up @@ -105,9 +104,8 @@ type VMAnomalySpec struct {
License *vmv1beta1.License `json:"license,omitempty"`
// ServiceAccountName is the name of the ServiceAccount to use to run the pods
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty"`
vmv1beta1.CommonDefaultableParams `json:",inline,omitempty"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
vmv1beta1.CommonAppsParams `json:",inline,omitempty"`
}

// VMAnomalyWritersSpec defines writer configuration for VMAnomaly
Expand Down Expand Up @@ -398,11 +396,6 @@ func (cr *VMAnomaly) GetAdditionalService() *vmv1beta1.AdditionalServiceSpec {
return nil
}

// Probe implements build.probeCRD interface
func (cr *VMAnomaly) Probe() *vmv1beta1.EmbeddedProbes {
return cr.Spec.EmbeddedProbes
}

// ProbePath implements build.probeCRD interface
func (cr *VMAnomaly) ProbePath() string {
if cr.Spec.Server != nil && cr.Spec.Server.PathPrefix != "" {
Expand Down Expand Up @@ -462,6 +455,11 @@ func (cr *VMAnomaly) Paused() bool {
return cr.Spec.Paused
}

// UseProxyProtocol implements build.probeCRD interface
func (cr *VMAnomaly) UseProxyProtocol() bool {
return false
}

// UnmarshalJSON implements json.Unmarshaler interface
func (cr *VMAnomalySpec) UnmarshalJSON(src []byte) error {
type pcr VMAnomalySpec
Expand Down
44 changes: 19 additions & 25 deletions api/operator/v1/vtcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ type VTInsert struct {
ServiceScrapeSpec *vmv1beta1.VMServiceScrapeSpec `json:"serviceScrapeSpec,omitempty"`
// PodDisruptionBudget created by operator
// +optional
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
*vmv1beta1.EmbeddedProbes `json:",inline"`
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
// Configures horizontal pod autoscaling.
// +optional
HPA *vmv1beta1.EmbeddedHPA `json:"hpa,omitempty"`
Expand All @@ -251,13 +250,12 @@ type VTInsert struct {
// +optional
RollingUpdate *appsv1.RollingUpdateDeployment `json:"rollingUpdate,omitempty"`

vmv1beta1.CommonDefaultableParams `json:",inline"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline"`
vmv1beta1.CommonAppsParams `json:",inline"`
}

// Probe implements build.probeCRD interface
func (cr *VTInsert) Probe() *vmv1beta1.EmbeddedProbes {
return cr.EmbeddedProbes
// UseProxyProtocol implements build.probeCRD interface
func (cr *VTInsert) UseProxyProtocol() bool {
return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
}

// ProbePath implements build.probeCRD interface
Expand Down Expand Up @@ -331,8 +329,7 @@ type VTSelect struct {
ServiceScrapeSpec *vmv1beta1.VMServiceScrapeSpec `json:"serviceScrapeSpec,omitempty"`
// PodDisruptionBudget created by operator
// +optional
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
*vmv1beta1.EmbeddedProbes `json:",inline"`
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
// Configures horizontal pod autoscaling.
// +optional
HPA *vmv1beta1.EmbeddedHPA `json:"hpa,omitempty"`
Expand All @@ -351,8 +348,7 @@ type VTSelect struct {
// ExtraStorageNodes - defines additional storage nodes to VTSelect
ExtraStorageNodes []VTStorageNode `json:"extraStorageNodes,omitempty"`

vmv1beta1.CommonDefaultableParams `json:",inline"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline"`
vmv1beta1.CommonAppsParams `json:",inline"`
}

// GetMetricsPath returns prefixed path for metric requests
Expand All @@ -363,6 +359,11 @@ func (cr *VTSelect) GetMetricsPath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, metricsPath)
}

// UseProxyProtocol implements build.probeCRD interface
func (cr *VTSelect) UseProxyProtocol() bool {
return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
}

// ExtraArgs returns additionally configured command-line arguments
func (cr *VTSelect) GetExtraArgs() map[string]string {
return cr.ExtraArgs
Expand All @@ -378,11 +379,6 @@ func (cr *VTSelect) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
}

// Probe implements build.probeCRD interface
func (cr *VTSelect) Probe() *vmv1beta1.EmbeddedProbes {
return cr.EmbeddedProbes
}

// ProbePath implements build.probeCRD interface
func (cr *VTSelect) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
Expand Down Expand Up @@ -450,8 +446,7 @@ type VTStorage struct {
ServiceScrapeSpec *vmv1beta1.VMServiceScrapeSpec `json:"serviceScrapeSpec,omitempty"`
// PodDisruptionBudget created by operator
// +optional
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
*vmv1beta1.EmbeddedProbes `json:",inline"`
PodDisruptionBudget *vmv1beta1.EmbeddedPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
// RollingUpdateStrategy defines strategy for application updates
// Default is OnDelete, in this case operator handles update process
// Can be changed for RollingUpdate
Expand Down Expand Up @@ -487,8 +482,7 @@ type VTStorage struct {
// +optional
MaintenanceSelectNodeIDs []int32 `json:"maintenanceSelectNodeIDs,omitempty"`

vmv1beta1.CommonDefaultableParams `json:",inline"`
vmv1beta1.CommonApplicationDeploymentParams `json:",inline"`
vmv1beta1.CommonAppsParams `json:",inline"`

// RollingUpdateStrategyBehavior defines customized behavior for rolling updates.
// It applies if the RollingUpdateStrategy is set to OnDelete, which is the default.
Expand All @@ -504,6 +498,11 @@ func (cr *VTStorage) GetStorageVolumeName() string {
return "vtstorage-db"
}

// UseProxyProtocol implements build.probeCRD interface
func (cr *VTStorage) UseProxyProtocol() bool {
return vmv1beta1.UseProxyProtocol(cr.ExtraArgs)
}

// GetMetricsPath returns prefixed path for metric requests
func (cr *VTStorage) GetMetricsPath() string {
if cr == nil {
Expand All @@ -527,11 +526,6 @@ func (cr *VTStorage) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec {
return cr.ServiceScrapeSpec
}

// Probe implements build.probeCRD interface
func (cr *VTStorage) Probe() *vmv1beta1.EmbeddedProbes {
return cr.EmbeddedProbes
}

// ProbePath implements build.probeCRD interface
func (cr *VTStorage) ProbePath() string {
return vmv1beta1.BuildPathWithPrefixFlag(cr.ExtraArgs, healthPath)
Expand Down
Loading